Changes generated with clang-modernize.
Additionally, fixed some struct-vs-class usage to make clang happy.
Change-Id: Ic6ef2427401ff1e794d26f21f7b44868fc75fb72
friend class AssetAtlas;
};
- AssetAtlas(): mTexture(NULL), mImage(NULL),
+ AssetAtlas(): mTexture(nullptr), mImage(nullptr),
mBlendKey(true), mOpaqueKey(false) { }
~AssetAtlas() { terminate(); }
int getHeight() { return mHeight; }
inline const Snapshot* currentSnapshot() const {
- return mSnapshot != NULL ? mSnapshot.get() : mFirstSnapshot.get();
+ return mSnapshot != nullptr ? mSnapshot.get() : mFirstSnapshot.get();
}
inline Snapshot* writableSnapshot() { return mSnapshot.get(); }
inline const Snapshot* firstSnapshot() const { return mFirstSnapshot.get(); }
class OpStatePair {
public:
OpStatePair()
- : op(NULL), state(NULL) {}
+ : op(nullptr), state(nullptr) {}
OpStatePair(DrawOp* newOp, const DeferredDisplayState* newState)
: op(newOp), state(newState) {}
OpStatePair(const OpStatePair& other)
// ----------------------------------------------------------------------------
// Frame state operations
// ----------------------------------------------------------------------------
- virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
- virtual void prepare(bool opaque) {
+ virtual void prepareDirty(float left, float top, float right,
+ float bottom, bool opaque) override;
+ virtual void prepare(bool opaque) override {
prepareDirty(0.0f, 0.0f, mState.getWidth(), mState.getHeight(), opaque);
}
- virtual bool finish();
+ virtual bool finish() override;
virtual void interrupt();
virtual void resume();
// ----------------------------------------------------------------------------
// Canvas state operations
// ----------------------------------------------------------------------------
- virtual void setViewport(int width, int height) { mState.setViewport(width, height); }
+ virtual void setViewport(int width, int height) override { mState.setViewport(width, height); }
// Save (layer)
- virtual int getSaveCount() const { return mState.getSaveCount(); }
- virtual int save(int flags);
- virtual void restore();
- virtual void restoreToCount(int saveCount);
+ virtual int getSaveCount() const override { return mState.getSaveCount(); }
+ virtual int save(int flags) override;
+ virtual void restore() override;
+ virtual void restoreToCount(int saveCount) override;
virtual int saveLayer(float left, float top, float right, float bottom,
- const SkPaint* paint, int flags);
+ const SkPaint* paint, int flags) override;
// Matrix
- virtual void getMatrix(SkMatrix* outMatrix) const { mState.getMatrix(outMatrix); }
+ virtual void getMatrix(SkMatrix* outMatrix) const override { mState.getMatrix(outMatrix); }
- virtual void translate(float dx, float dy, float dz = 0.0f);
- virtual void rotate(float degrees);
- virtual void scale(float sx, float sy);
- virtual void skew(float sx, float sy);
+ virtual void translate(float dx, float dy, float dz = 0.0f) override;
+ virtual void rotate(float degrees) override;
+ virtual void scale(float sx, float sy) override;
+ virtual void skew(float sx, float sy) override;
- virtual void setMatrix(const SkMatrix& matrix);
- virtual void concatMatrix(const SkMatrix& matrix);
+ virtual void setMatrix(const SkMatrix& matrix) override;
+ virtual void concatMatrix(const SkMatrix& matrix) override;
// Clip
- virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
- virtual bool clipPath(const SkPath* path, SkRegion::Op op);
- virtual bool clipRegion(const SkRegion* region, SkRegion::Op op);
+ virtual bool clipRect(float left, float top, float right, float bottom,
+ SkRegion::Op op) override;
+ virtual bool clipPath(const SkPath* path, SkRegion::Op op) override;
+ virtual bool clipRegion(const SkRegion* region, SkRegion::Op op) override;
// Misc
- virtual void setDrawFilter(SkDrawFilter* filter);
- virtual const Rect& getLocalClipBounds() const { return mState.getLocalClipBounds(); }
+ virtual void setDrawFilter(SkDrawFilter* filter) override;
+ virtual const Rect& getLocalClipBounds() const override { return mState.getLocalClipBounds(); }
const Rect& getRenderTargetClipBounds() const { return mState.getRenderTargetClipBounds(); }
- virtual bool quickRejectConservative(float left, float top, float right, float bottom) const {
+ virtual bool quickRejectConservative(float left, float top,
+ float right, float bottom) const override {
return mState.quickRejectConservative(left, top, right, bottom);
}
// ----------------------------------------------------------------------------
// Canvas draw operations
// ----------------------------------------------------------------------------
- virtual void drawColor(int color, SkXfermode::Mode mode);
+ virtual void drawColor(int color, SkXfermode::Mode mode) override;
// Bitmap-based
- virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint);
+ virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) override;
virtual void drawBitmap(const SkBitmap* bitmap, float srcLeft, float srcTop,
float srcRight, float srcBottom, float dstLeft, float dstTop,
- float dstRight, float dstBottom, const SkPaint* paint);
- virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint);
+ float dstRight, float dstBottom, const SkPaint* paint) override;
+ virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint) override;
virtual void drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int meshHeight,
- const float* vertices, const int* colors, const SkPaint* paint);
+ const float* vertices, const int* colors, const SkPaint* paint) override;
virtual void drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch,
- float left, float top, float right, float bottom, const SkPaint* paint);
+ float left, float top, float right, float bottom, const SkPaint* paint) override;
// Shapes
virtual void drawRect(float left, float top, float right, float bottom,
- const SkPaint* paint);
- virtual void drawRects(const float* rects, int count, const SkPaint* paint);
+ const SkPaint* paint) override;
+ virtual void drawRects(const float* rects, int count, const SkPaint* paint) override;
virtual void drawRoundRect(float left, float top, float right, float bottom,
- float rx, float ry, const SkPaint* paint);
+ float rx, float ry, const SkPaint* paint) override;
virtual void drawRoundRect(CanvasPropertyPrimitive* left, CanvasPropertyPrimitive* top,
CanvasPropertyPrimitive* right, CanvasPropertyPrimitive* bottom,
CanvasPropertyPrimitive* rx, CanvasPropertyPrimitive* ry,
CanvasPropertyPaint* paint);
- virtual void drawCircle(float x, float y, float radius, const SkPaint* paint);
+ virtual void drawCircle(float x, float y, float radius, const SkPaint* paint) override;
virtual void drawCircle(CanvasPropertyPrimitive* x, CanvasPropertyPrimitive* y,
CanvasPropertyPrimitive* radius, CanvasPropertyPaint* paint);
virtual void drawOval(float left, float top, float right, float bottom,
- const SkPaint* paint);
+ const SkPaint* paint) override;
virtual void drawArc(float left, float top, float right, float bottom,
- float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint);
- virtual void drawPath(const SkPath* path, const SkPaint* paint);
- virtual void drawLines(const float* points, int count, const SkPaint* paint);
- virtual void drawPoints(const float* points, int count, const SkPaint* paint);
+ float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint) override;
+ virtual void drawPath(const SkPath* path, const SkPaint* paint) override;
+ virtual void drawLines(const float* points, int count, const SkPaint* paint) override;
+ virtual void drawPoints(const float* points, int count, const SkPaint* paint) override;
// Text
virtual void drawText(const char* text, int bytesCount, int count, float x, float y,
const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds,
- DrawOpMode drawOpMode = kDrawOpMode_Immediate);
+ DrawOpMode drawOpMode = kDrawOpMode_Immediate) override;
virtual void drawTextOnPath(const char* text, int bytesCount, int count, const SkPath* path,
- float hOffset, float vOffset, const SkPaint* paint);
+ float hOffset, float vOffset, const SkPaint* paint) override;
virtual void drawPosText(const char* text, int bytesCount, int count,
- const float* positions, const SkPaint* paint);
+ const float* positions, const SkPaint* paint) override;
// ----------------------------------------------------------------------------
// Canvas draw operations - special
// ----------------------------------------------------------------------------
virtual void drawLayer(DeferredLayerUpdater* layerHandle, float x, float y);
- virtual void drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t replayFlags);
+ virtual void drawRenderNode(RenderNode* renderNode, Rect& dirty, int32_t replayFlags) override;
// TODO: rename for consistency
- virtual void callDrawGLFunction(Functor* functor, Rect& dirty);
+ virtual void callDrawGLFunction(Functor* functor, Rect& dirty) override;
void setHighContrastText(bool highContrastText) {
mHighContrastText = highContrastText;
// ----------------------------------------------------------------------------
// CanvasState callbacks
// ----------------------------------------------------------------------------
- virtual void onViewportInitialized() { }
- virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) { }
- virtual GLuint onGetTargetFbo() const { return -1; }
+ virtual void onViewportInitialized() override { }
+ virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) override { }
+ virtual GLuint onGetTargetFbo() const override { return -1; }
private:
template<class T>
inline const T* refBuffer(const T* srcBuffer, int32_t count) {
- if (!srcBuffer) return NULL;
+ if (!srcBuffer) return nullptr;
T* dstBuffer = (T*) mDisplayListData->allocator.alloc(count * sizeof(T));
memcpy(dstBuffer, srcBuffer, count * sizeof(T));
}
inline const SkPath* refPath(const SkPath* path) {
- if (!path) return NULL;
+ if (!path) return nullptr;
const SkPath* pathCopy = mPathMap.valueFor(path);
- if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) {
+ if (pathCopy == nullptr || pathCopy->getGenerationID() != path->getGenerationID()) {
SkPath* newPathCopy = new SkPath(*path);
newPathCopy->setSourcePath(path);
}
inline const SkPaint* refPaint(const SkPaint* paint) {
- if (!paint) return NULL;
+ if (!paint) return nullptr;
// If there is a draw filter apply it here and store the modified paint
// so that we don't need to modify the paint every time we access it.
const SkPaint* cachedPaint = mPaintMap.valueFor(key);
// In the unlikely event that 2 unique paints have the same hash we do a
// object equality check to ensure we don't erroneously dedup them.
- if (cachedPaint == NULL || *cachedPaint != *paint) {
+ if (cachedPaint == nullptr || *cachedPaint != *paint) {
cachedPaint = new SkPaint(*paint);
// replaceValueFor() performs an add if the entry doesn't exist
mPaintMap.replaceValueFor(key, cachedPaint);
}
inline SkPaint* copyPaint(const SkPaint* paint) {
- if (!paint) return NULL;
+ if (!paint) return nullptr;
SkPaint* paintCopy = new SkPaint(*paint);
mDisplayListData->paints.add(paintCopy);
const SkRegion* regionCopy = mRegionMap.valueFor(region);
// TODO: Add generation ID to SkRegion
- if (regionCopy == NULL) {
+ if (regionCopy == nullptr) {
regionCopy = new SkRegion(*region);
// replaceValueFor() performs an add if the entry doesn't exist
mRegionMap.replaceValueFor(region, regionCopy);
Fence() {
mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY);
if (mDisplay != EGL_NO_DISPLAY) {
- mFence = eglCreateSyncKHR(mDisplay, EGL_SYNC_FENCE_KHR, NULL);
+ mFence = eglCreateSyncKHR(mDisplay, EGL_SYNC_FENCE_KHR, nullptr);
} else {
mFence = EGL_NO_SYNC_KHR;
}
}
~TextSetupFunctor() { }
- status_t operator ()(int what, void* data);
+ status_t operator ()(int what, void* data) override;
OpenGLRenderer* renderer;
float x;
delete mRenderer;
}
- void clear() {
+ void clear() override {
delete mRenderer;
- mRenderer = NULL;
+ mRenderer = nullptr;
}
- void flush() {
+ void flush() override {
if (mRenderer) {
mRenderer->flushLargeCaches();
}
}
- FontRenderer& getFontRenderer(const SkPaint* paint) {
+ FontRenderer& getFontRenderer(const SkPaint* paint) override {
if (!mRenderer) {
mRenderer = new FontRenderer;
}
return *mRenderer;
}
- uint32_t getFontRendererCount() const {
+ uint32_t getFontRendererCount() const override {
return 1;
}
- uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+ uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const override {
return mRenderer ? mRenderer->getCacheSize(format) : 0;
}
- void describe(ProgramDescription& description, const SkPaint* paint) const;
- void setupProgram(ProgramDescription& description, Program* program) const;
+ void describe(ProgramDescription& description, const SkPaint* paint) const override;
+ void setupProgram(ProgramDescription& description, Program* program) const override;
- void endPrecaching();
+ void endPrecaching() override;
private:
ShaderGammaFontRenderer(bool multiGamma);
delete mRenderer;
}
- void clear() {
+ void clear() override {
delete mRenderer;
- mRenderer = NULL;
+ mRenderer = nullptr;
}
- void flush() {
+ void flush() override {
if (mRenderer) {
mRenderer->flushLargeCaches();
}
}
- FontRenderer& getFontRenderer(const SkPaint* paint) {
+ FontRenderer& getFontRenderer(const SkPaint* paint) override {
if (!mRenderer) {
mRenderer = new FontRenderer;
mRenderer->setGammaTable(&mGammaTable[0]);
return *mRenderer;
}
- uint32_t getFontRendererCount() const {
+ uint32_t getFontRendererCount() const override {
return 1;
}
- uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+ uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const override {
return mRenderer ? mRenderer->getCacheSize(format) : 0;
}
- void describe(ProgramDescription& description, const SkPaint* paint) const {
+ void describe(ProgramDescription& description, const SkPaint* paint) const override {
}
- void setupProgram(ProgramDescription& description, Program* program) const {
+ void setupProgram(ProgramDescription& description, Program* program) const override {
}
- void endPrecaching();
+ void endPrecaching() override;
private:
LookupGammaFontRenderer();
public:
~Lookup3GammaFontRenderer();
- void clear();
- void flush();
+ void clear() override;
+ void flush() override;
- FontRenderer& getFontRenderer(const SkPaint* paint);
+ FontRenderer& getFontRenderer(const SkPaint* paint) override;
- uint32_t getFontRendererCount() const {
+ uint32_t getFontRendererCount() const override {
return kGammaCount;
}
- uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const {
+ uint32_t getFontRendererSize(uint32_t fontRenderer, GLenum format) const override {
if (fontRenderer >= kGammaCount) return 0;
FontRenderer* renderer = mRenderers[fontRenderer];
return renderer->getCacheSize(format);
}
- void describe(ProgramDescription& description, const SkPaint* paint) const {
+ void describe(ProgramDescription& description, const SkPaint* paint) const override {
}
- void setupProgram(ProgramDescription& description, Program* program) const {
+ void setupProgram(ProgramDescription& description, Program* program) const override {
}
- void endPrecaching();
+ void endPrecaching() override;
private:
Lookup3GammaFontRenderer();
struct GradientCacheEntry {
GradientCacheEntry() {
count = 0;
- colors = NULL;
- positions = NULL;
+ colors = nullptr;
+ positions = nullptr;
}
GradientCacheEntry(uint32_t* colors, float* positions, uint32_t count) {
* Used as a callback when an entry is removed from the cache.
* Do not invoke directly.
*/
- void operator()(GradientCacheEntry& shader, Texture*& texture);
+ void operator()(GradientCacheEntry& shader, Texture*& texture) override;
/**
* Returns the texture associated with the specified shader.
private:
struct LayerEntry {
LayerEntry():
- mLayer(NULL), mWidth(0), mHeight(0) {
+ mLayer(nullptr), mWidth(0), mHeight(0) {
}
- LayerEntry(const uint32_t layerWidth, const uint32_t layerHeight): mLayer(NULL) {
+ LayerEntry(const uint32_t layerWidth, const uint32_t layerHeight): mLayer(nullptr) {
mWidth = Layer::computeIdealWidth(layerWidth);
mHeight = Layer::computeIdealHeight(layerHeight);
}
void decomposeScale(float& sx, float& sy) const;
- void dump(const char* label = NULL) const;
+ void dump(const char* label = nullptr) const;
static const Matrix4& identity();
writableSnapshot()->resetTransform(-bounds.left, -bounds.top, 0.0f);
writableSnapshot()->resetClip(clip.left, clip.top, clip.right, clip.bottom);
writableSnapshot()->initializeViewport(bounds.getWidth(), bounds.getHeight());
- writableSnapshot()->roundRectClipState = NULL;
+ writableSnapshot()->roundRectClipState = nullptr;
}
}
// Unfortunately some drivers will turn the entire target texture black
// when reading outside of the window.
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, layer->getWidth(), layer->getHeight(),
- 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
layer->setEmpty(false);
}
writableSnapshot()->resetTransform(-bounds.left, -bounds.top, 0.0f);
writableSnapshot()->resetClip(clip.left, clip.top, clip.right, clip.bottom);
writableSnapshot()->initializeViewport(bounds.getWidth(), bounds.getHeight());
- writableSnapshot()->roundRectClipState = NULL;
+ writableSnapshot()->roundRectClipState = nullptr;
endTiling();
debugOverdraw(false, false);
bool clipRequired = false;
mState.calculateQuickRejectForScissor(rect.left, rect.top, rect.right, rect.bottom,
- &clipRequired, NULL, false); // safely ignore return, should never be rejected
+ &clipRequired, nullptr, false); // safely ignore return, should never be rejected
mCaches.setScissorEnabled(mScissorOptimizationDisabled || clipRequired);
if (fboLayer) {
dirtyClip();
// Failing to add the layer to the cache should happen only if the layer is too large
- layer->setConvexMask(NULL);
+ layer->setConvexMask(nullptr);
if (!mCaches.layerCache.put(layer)) {
LAYER_LOGD("Deleting layer");
- layer->decStrong(0);
+ layer->decStrong(nullptr);
}
}
, mLayer(layer) {
}
- virtual bool asACustomShader(void** data) const {
+ virtual bool asACustomShader(void** data) const override {
if (data) {
*data = static_cast<void*>(mLayer);
}
return true;
}
- virtual bool isOpaque() const {
+ virtual bool isOpaque() const override {
return !mLayer->isBlend();
}
LOG_ALWAYS_FATAL("LayerShader should never be drawn with raster backend.");
}
- virtual void flatten(SkWriteBuffer&) const {
+ virtual void flatten(SkWriteBuffer&) const override {
LOG_ALWAYS_FATAL("LayerShader should never be flattened.");
}
- virtual Factory getFactory() const {
+ virtual Factory getFactory() const override {
LOG_ALWAYS_FATAL("LayerShader should never be created from a stream.");
- return NULL;
+ return nullptr;
}
private:
// Unowned.
const SkPath* maskPath = layer->getConvexMask();
DRAW_DOUBLE_STENCIL(drawConvexPath(*maskPath, &paint));
- paint.setShader(NULL);
+ paint.setShader(nullptr);
restore();
return;
if (numQuads >= gMaxNumberOfQuads) {
DRAW_DOUBLE_STENCIL(glDrawElements(GL_TRIANGLES, numQuads * 6,
- GL_UNSIGNED_SHORT, NULL));
+ GL_UNSIGNED_SHORT, nullptr));
numQuads = 0;
mesh = mCaches.getRegionMesh();
}
if (numQuads > 0) {
DRAW_DOUBLE_STENCIL(glDrawElements(GL_TRIANGLES, numQuads * 6,
- GL_UNSIGNED_SHORT, NULL));
+ GL_UNSIGNED_SHORT, nullptr));
}
#if DEBUG_LAYERS_AS_REGIONS
GLsizei drawCount = min(elementsCount, (GLsizei) gMaxNumberOfQuads * 6);
setupDrawIndexedVertices(&mesh[0].x);
- glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, NULL);
+ glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, nullptr);
elementsCount -= drawCount;
// Though there are 4 vertices in a quad, we use 6 indices per
* This method should be called when restoreDisplayState() won't be restoring the clip
*/
void OpenGLRenderer::setupMergedMultiDraw(const Rect* clipRect) {
- if (clipRect != NULL) {
+ if (clipRect != nullptr) {
writableSnapshot()->setClip(clipRect->left, clipRect->top, clipRect->right, clipRect->bottom);
} else {
writableSnapshot()->setClip(0, 0, mState.getWidth(), mState.getHeight());
}
dirtyClip();
- mCaches.setScissorEnabled(clipRect != NULL || mScissorOptimizationDisabled);
+ mCaches.setScissorEnabled(clipRect != nullptr || mScissorOptimizationDisabled);
}
///////////////////////////////////////////////////////////////////////////////
}
void OpenGLRenderer::setupDrawShader(const SkShader* shader) {
- if (shader != NULL) {
+ if (shader != nullptr) {
SkiaShader::describe(&mCaches, mDescription, mExtensions, *shader);
}
}
void OpenGLRenderer::setupDrawColorFilter(const SkColorFilter* filter) {
- if (filter == NULL) {
+ if (filter == nullptr) {
return;
}
SkXfermode::Mode mode;
- if (filter->asColorMode(NULL, &mode)) {
+ if (filter->asColorMode(nullptr, &mode)) {
mDescription.colorOp = ProgramDescription::kColorBlend;
mDescription.colorMode = mode;
- } else if (filter->asColorMatrix(NULL)) {
+ } else if (filter->asColorMatrix(nullptr)) {
mDescription.colorOp = ProgramDescription::kColorMatrix;
}
}
bool dirty = right - left > 0.0f && bottom - top > 0.0f;
const Matrix4& transformMatrix = ignoreTransform ? Matrix4::identity() : *currentTransform();
- mCaches.currentProgram->set(writableSnapshot()->getOrthoMatrix(), mModelViewMatrix, transformMatrix, offset);
+ mCaches.currentProgram->set(writableSnapshot()->getOrthoMatrix(),
+ mModelViewMatrix, transformMatrix, offset);
if (dirty && mTrackDirtyRegions) {
if (!ignoreTransform) {
dirtyLayer(left, top, right, bottom, *currentTransform());
}
void OpenGLRenderer::setupDrawShaderUniforms(const SkShader* shader, bool ignoreTransform) {
- if (shader == NULL) {
+ if (shader == nullptr) {
return;
}
}
void OpenGLRenderer::setupDrawColorFilterUniforms(const SkColorFilter* filter) {
- if (NULL == filter) {
+ if (nullptr == filter) {
return;
}
void OpenGLRenderer::setupDrawSimpleMesh() {
bool force = mCaches.bindMeshBuffer();
- mCaches.bindPositionVertexPointer(force, 0);
+ mCaches.bindPositionVertexPointer(force, nullptr);
mCaches.unbindIndicesBuffer();
}
}
}
-void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top, const SkPaint* paint) {
+void OpenGLRenderer::drawAlphaBitmap(Texture* texture, float left, float top,
+ const SkPaint* paint) {
float x = left;
float y = top;
// No need to check for a UV mapper on the texture object, only ARGB_8888
// bitmaps get packed in the atlas
drawAlpha8TextureMesh(x, y, x + texture->width, y + texture->height, texture->id,
- paint, (GLvoid*) NULL, (GLvoid*) gMeshTextureOffset,
+ paint, (GLvoid*) nullptr, (GLvoid*) gMeshTextureOffset,
GL_TRIANGLE_STRIP, gMeshCount, ignoreTransform);
}
glDrawArrays(GL_TRIANGLE_STRIP, 0, vertexBuffer.getVertexCount());
} else if (mode == VertexBuffer::kOnePolyRingShadow) {
mCaches.bindShadowIndicesBuffer();
- glDrawElements(GL_TRIANGLE_STRIP, ONE_POLY_RING_SHADOW_INDEX_COUNT, GL_UNSIGNED_SHORT, 0);
+ glDrawElements(GL_TRIANGLE_STRIP, ONE_POLY_RING_SHADOW_INDEX_COUNT,
+ GL_UNSIGNED_SHORT, nullptr);
} else if (mode == VertexBuffer::kTwoPolyRingShadow) {
mCaches.bindShadowIndicesBuffer();
- glDrawElements(GL_TRIANGLE_STRIP, TWO_POLY_RING_SHADOW_INDEX_COUNT, GL_UNSIGNED_SHORT, 0);
+ glDrawElements(GL_TRIANGLE_STRIP, TWO_POLY_RING_SHADOW_INDEX_COUNT,
+ GL_UNSIGNED_SHORT, nullptr);
} else if (mode == VertexBuffer::kIndices) {
mCaches.unbindIndicesBuffer();
- glDrawElements(GL_TRIANGLE_STRIP, vertexBuffer.getIndexCount(), GL_UNSIGNED_SHORT,
- vertexBuffer.getIndices());
+ glDrawElements(GL_TRIANGLE_STRIP, vertexBuffer.getIndexCount(),
+ GL_UNSIGNED_SHORT, vertexBuffer.getIndices());
}
if (isAA) {
return;
}
- if (p->getPathEffect() != 0) {
+ if (p->getPathEffect() != nullptr) {
mCaches.activeTexture(0);
const PathTexture* texture = mCaches.pathCache.getRoundRect(
right - left, bottom - top, rx, ry, p);
|| paintWillNotDraw(*p)) {
return;
}
- if (p->getPathEffect() != 0) {
+ if (p->getPathEffect() != nullptr) {
mCaches.activeTexture(0);
const PathTexture* texture = mCaches.pathCache.getCircle(radius, p);
drawShape(x - radius, y - radius, texture, p);
return;
}
- if (p->getPathEffect() != 0) {
+ if (p->getPathEffect() != nullptr) {
mCaches.activeTexture(0);
const PathTexture* texture = mCaches.pathCache.getOval(right - left, bottom - top, p);
drawShape(left, top, texture, p);
}
// TODO: support fills (accounting for concavity if useCenter && sweepAngle > 180)
- if (p->getStyle() != SkPaint::kStroke_Style || p->getPathEffect() != 0 || useCenter) {
+ if (p->getStyle() != SkPaint::kStroke_Style || p->getPathEffect() != nullptr || useCenter) {
mCaches.activeTexture(0);
const PathTexture* texture = mCaches.pathCache.getArc(right - left, bottom - top,
startAngle, sweepAngle, useCenter, p);
if (p->getStyle() != SkPaint::kFill_Style) {
// only fill style is supported by drawConvexPath, since others have to handle joins
- if (p->getPathEffect() != 0 || p->getStrokeJoin() != SkPaint::kMiter_Join ||
+ if (p->getPathEffect() != nullptr || p->getStrokeJoin() != SkPaint::kMiter_Join ||
p->getStrokeMiter() != SkPaintDefaults_MiterLimit) {
mCaches.activeTexture(0);
const PathTexture* texture =
setupDrawPureColorUniforms();
setupDrawColorFilterUniforms(getColorFilter(paint));
setupDrawShaderUniforms(getShader(paint));
- setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
+ setupDrawMesh(nullptr, (GLvoid*) gMeshTextureOffset);
glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
}
void OpenGLRenderer::drawPosText(const char* text, int bytesCount, int count,
const float* positions, const SkPaint* paint) {
- if (text == NULL || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
+ if (text == nullptr || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
return;
}
TextSetupFunctor functor(this, x, y, pureTranslate, alpha, mode, paint);
if (fontRenderer.renderPosText(paint, clip, text, 0, bytesCount, count, x, y,
- positions, hasActiveLayer ? &bounds : NULL, &functor)) {
+ positions, hasActiveLayer ? &bounds : nullptr, &functor)) {
if (hasActiveLayer) {
if (!pureTranslate) {
currentTransform()->mapRect(bounds);
if (drawOpMode == kDrawOpMode_Immediate) {
// The checks for corner-case ignorable text and quick rejection is only done for immediate
// drawing as ops from DeferredDisplayList are already filtered for these
- if (text == NULL || count == 0 || mState.currentlyIgnored() || canSkipText(paint) ||
+ if (text == nullptr || count == 0 || mState.currentlyIgnored() || canSkipText(paint) ||
quickRejectSetupScissor(bounds)) {
return;
}
fontRenderer.setTextureFiltering(linearFilter);
// TODO: Implement better clipping for scaled/rotated text
- const Rect* clip = !pureTranslate ? NULL : mState.currentClipRect();
+ const Rect* clip = !pureTranslate ? nullptr : mState.currentClipRect();
Rect layerBounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f);
bool status;
SkPaint paintCopy(*paint);
paintCopy.setTextAlign(SkPaint::kLeft_Align);
status = fontRenderer.renderPosText(&paintCopy, clip, text, 0, bytesCount, count, x, y,
- positions, hasActiveLayer ? &layerBounds : NULL, &functor, forceFinish);
+ positions, hasActiveLayer ? &layerBounds : nullptr, &functor, forceFinish);
} else {
status = fontRenderer.renderPosText(paint, clip, text, 0, bytesCount, count, x, y,
- positions, hasActiveLayer ? &layerBounds : NULL, &functor, forceFinish);
+ positions, hasActiveLayer ? &layerBounds : nullptr, &functor, forceFinish);
}
if ((status || drawOpMode != kDrawOpMode_Immediate) && hasActiveLayer) {
void OpenGLRenderer::drawTextOnPath(const char* text, int bytesCount, int count,
const SkPath* path, float hOffset, float vOffset, const SkPaint* paint) {
- if (text == NULL || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
+ if (text == nullptr || count == 0 || mState.currentlyIgnored() || canSkipText(paint)) {
return;
}
const bool hasActiveLayer = hasLayer();
if (fontRenderer.renderTextOnPath(paint, clip, text, 0, bytesCount, count, path,
- hOffset, vOffset, hasActiveLayer ? &bounds : NULL, &functor)) {
+ hOffset, vOffset, hasActiveLayer ? &bounds : nullptr, &functor)) {
if (hasActiveLayer) {
currentTransform()->mapRect(bounds);
dirtyLayerUnchecked(bounds, getRegion());
return;
}
- mat4* transform = NULL;
+ mat4* transform = nullptr;
if (layer->isTextureLayer()) {
transform = &layer->getTransform();
if (!transform->isIdentity()) {
}
bool clipRequired = false;
- const bool rejected = mState.calculateQuickRejectForScissor(x, y,
- x + layer->layer.getWidth(), y + layer->layer.getHeight(), &clipRequired, NULL, false);
+ const bool rejected = mState.calculateQuickRejectForScissor(
+ x, y, x + layer->layer.getWidth(), y + layer->layer.getHeight(),
+ &clipRequired, nullptr, false);
if (rejected) {
if (transform && !transform->isIdentity()) {
setupDrawMeshIndices(&mesh[0].x, &mesh[0].u);
DRAW_DOUBLE_STENCIL_IF(!layer->hasDrawnSinceUpdate,
- glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, NULL));
+ glDrawElements(GL_TRIANGLES, drawCount, GL_UNSIGNED_SHORT, nullptr));
elementsCount -= drawCount;
// Though there are 4 vertices in a quad, we use 6 indices per
setupDrawPureColorUniforms();
setupDrawColorFilterUniforms(getColorFilter(paint));
setupDrawShaderUniforms(getShader(paint));
- setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
+ setupDrawMesh(nullptr, (GLvoid*) gMeshTextureOffset);
glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
}
Texture* texture, const SkPaint* paint) {
texture->setWrap(GL_CLAMP_TO_EDGE, true);
- GLvoid* vertices = (GLvoid*) NULL;
+ GLvoid* vertices = (GLvoid*) nullptr;
GLvoid* texCoords = (GLvoid*) gMeshTextureOffset;
if (texture->uvMapper) {
setupDrawColorFilterUniforms(getColorFilter(paint));
setupDrawMeshIndices(vertices, texCoords, vbo);
- glDrawElements(drawMode, elementsCount, GL_UNSIGNED_SHORT, NULL);
+ glDrawElements(drawMode, elementsCount, GL_UNSIGNED_SHORT, nullptr);
}
void OpenGLRenderer::drawAlpha8TextureMesh(float left, float top, float right, float bottom,
GLvoid* vertices, GLvoid* texCoords, GLenum drawMode, GLsizei elementsCount,
bool ignoreTransform, ModelViewMode modelViewMode, bool dirty) {
- int color = paint != NULL ? paint->getColor() : 0;
+ int color = paint != nullptr ? paint->getColor() : 0;
int alpha;
SkXfermode::Mode mode;
getAlphaAndMode(paint, &alpha, &mode);
setupDraw();
setupDrawWithTexture(true);
- if (paint != NULL) {
+ if (paint != nullptr) {
setupDrawAlpha8Color(color, alpha);
}
setupDrawColorFilter(getColorFilter(paint));
void OpenGLRenderer::chooseBlending(bool blend, SkXfermode::Mode mode,
ProgramDescription& description, bool swapSrcDst) {
- if (writableSnapshot()->roundRectClipState != NULL /*&& !mSkipOutlineClip*/) {
+ if (writableSnapshot()->roundRectClipState != nullptr /*&& !mSkipOutlineClip*/) {
blend = true;
mDescription.hasRoundRectClip = true;
}
bool OpenGLRenderer::useProgram(Program* program) {
if (!program->isInUse()) {
- if (mCaches.currentProgram != NULL) mCaches.currentProgram->remove();
+ if (mCaches.currentProgram != nullptr) mCaches.currentProgram->remove();
program->use();
mCaches.currentProgram = program;
return false;
TextureVertex::setUV(v++, u2, v2);
}
-void OpenGLRenderer::getAlphaAndMode(const SkPaint* paint, int* alpha, SkXfermode::Mode* mode) const {
+void OpenGLRenderer::getAlphaAndMode(const SkPaint* paint, int* alpha,
+ SkXfermode::Mode* mode) const {
getAlphaAndModeDirect(paint, alpha, mode);
if (mDrawModifiers.mOverrideLayerAlpha < 1.0f) {
// if drawing a layer, ignore the paint's alpha
void initLight(const Vector3& lightCenter, float lightRadius,
uint8_t ambientShadowAlpha, uint8_t spotShadowAlpha);
- virtual void prepareDirty(float left, float top, float right, float bottom, bool opaque);
- virtual void prepare(bool opaque) {
+ virtual void prepareDirty(float left, float top, float right, float bottom,
+ bool opaque) override;
+ virtual void prepare(bool opaque) override {
prepareDirty(0.0f, 0.0f, mState.getWidth(), mState.getHeight(), opaque);
}
- virtual bool finish();
+ virtual bool finish() override;
- virtual void callDrawGLFunction(Functor* functor, Rect& dirty);
+ virtual void callDrawGLFunction(Functor* functor, Rect& dirty) override;
void pushLayerUpdate(Layer* layer);
void cancelLayerUpdate(Layer* layer);
void markLayersAsBuildLayers();
virtual int saveLayer(float left, float top, float right, float bottom,
- const SkPaint* paint, int flags) {
- return saveLayer(left, top, right, bottom, paint, flags, NULL);
+ const SkPaint* paint, int flags) override {
+ return saveLayer(left, top, right, bottom, paint, flags, nullptr);
}
// Specialized saveLayer implementation, which will pass the convexMask to an FBO layer, if
int saveLayerDeferred(float left, float top, float right, float bottom,
const SkPaint* paint, int flags);
- virtual void drawRenderNode(RenderNode* displayList, Rect& dirty, int32_t replayFlags = 1);
+ virtual void drawRenderNode(RenderNode* displayList, Rect& dirty,
+ int32_t replayFlags = 1) override;
virtual void drawLayer(Layer* layer, float x, float y);
- virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint);
+ virtual void drawBitmap(const SkBitmap* bitmap, const SkPaint* paint) override;
void drawBitmaps(const SkBitmap* bitmap, AssetAtlas::Entry* entry, int bitmapCount,
TextureVertex* vertices, bool pureTranslate, const Rect& bounds, const SkPaint* paint);
virtual void drawBitmap(const SkBitmap* bitmap, float srcLeft, float srcTop,
float srcRight, float srcBottom, float dstLeft, float dstTop,
- float dstRight, float dstBottom, const SkPaint* paint);
- virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint);
+ float dstRight, float dstBottom, const SkPaint* paint) override;
+ virtual void drawBitmapData(const SkBitmap* bitmap, const SkPaint* paint) override;
virtual void drawBitmapMesh(const SkBitmap* bitmap, int meshWidth, int meshHeight,
- const float* vertices, const int* colors, const SkPaint* paint);
+ const float* vertices, const int* colors, const SkPaint* paint) override;
void drawPatches(const SkBitmap* bitmap, AssetAtlas::Entry* entry,
TextureVertex* vertices, uint32_t indexCount, const SkPaint* paint);
virtual void drawPatch(const SkBitmap* bitmap, const Res_png_9patch* patch,
- float left, float top, float right, float bottom, const SkPaint* paint);
+ float left, float top, float right, float bottom, const SkPaint* paint) override;
void drawPatch(const SkBitmap* bitmap, const Patch* mesh, AssetAtlas::Entry* entry,
float left, float top, float right, float bottom, const SkPaint* paint);
- virtual void drawColor(int color, SkXfermode::Mode mode);
+ virtual void drawColor(int color, SkXfermode::Mode mode) override;
virtual void drawRect(float left, float top, float right, float bottom,
- const SkPaint* paint);
+ const SkPaint* paint) override;
virtual void drawRoundRect(float left, float top, float right, float bottom,
- float rx, float ry, const SkPaint* paint);
- virtual void drawCircle(float x, float y, float radius, const SkPaint* paint);
+ float rx, float ry, const SkPaint* paint) override;
+ virtual void drawCircle(float x, float y, float radius, const SkPaint* paint) override;
virtual void drawOval(float left, float top, float right, float bottom,
- const SkPaint* paint);
+ const SkPaint* paint) override;
virtual void drawArc(float left, float top, float right, float bottom,
- float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint);
- virtual void drawPath(const SkPath* path, const SkPaint* paint);
- virtual void drawLines(const float* points, int count, const SkPaint* paint);
- virtual void drawPoints(const float* points, int count, const SkPaint* paint);
+ float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint) override;
+ virtual void drawPath(const SkPath* path, const SkPaint* paint) override;
+ virtual void drawLines(const float* points, int count, const SkPaint* paint) override;
+ virtual void drawPoints(const float* points, int count, const SkPaint* paint) override;
virtual void drawTextOnPath(const char* text, int bytesCount, int count, const SkPath* path,
- float hOffset, float vOffset, const SkPaint* paint);
+ float hOffset, float vOffset, const SkPaint* paint) override;
virtual void drawPosText(const char* text, int bytesCount, int count,
- const float* positions, const SkPaint* paint);
+ const float* positions, const SkPaint* paint) override;
virtual void drawText(const char* text, int bytesCount, int count, float x, float y,
const float* positions, const SkPaint* paint, float totalAdvance, const Rect& bounds,
- DrawOpMode drawOpMode = kDrawOpMode_Immediate);
- virtual void drawRects(const float* rects, int count, const SkPaint* paint);
+ DrawOpMode drawOpMode = kDrawOpMode_Immediate) override;
+ virtual void drawRects(const float* rects, int count, const SkPaint* paint) override;
void drawShadow(float casterAlpha,
- const VertexBuffer* ambientShadowVertexBuffer, const VertexBuffer* spotShadowVertexBuffer);
+ const VertexBuffer* ambientShadowVertexBuffer,
+ const VertexBuffer* spotShadowVertexBuffer);
- virtual void setDrawFilter(SkDrawFilter* filter);
+ virtual void setDrawFilter(SkDrawFilter* filter) override;
// If this value is set to < 1.0, it overrides alpha set on layer (see drawBitmap, drawLayer)
void setOverrideLayerAlpha(float alpha) { mDrawModifiers.mOverrideLayerAlpha = alpha; }
* @param alpha Where to store the resulting alpha
* @param mode Where to store the resulting xfermode
*/
- static inline void getAlphaAndModeDirect(const SkPaint* paint, int* alpha, SkXfermode::Mode* mode) {
+ static inline void getAlphaAndModeDirect(const SkPaint* paint, int* alpha,
+ SkXfermode::Mode* mode) {
*mode = getXfermodeDirect(paint);
*alpha = getAlphaDirect(paint);
}
}
static inline bool hasTextShadow(const SkPaint* paint) {
- return getTextShadow(paint, NULL);
+ return getTextShadow(paint, nullptr);
}
/**
///////////////////////////////////////////////////////////////////
/// State manipulation
- virtual void setViewport(int width, int height) { mState.setViewport(width, height); }
+ virtual void setViewport(int width, int height) override { mState.setViewport(width, height); }
- virtual int getSaveCount() const;
- virtual int save(int flags);
- virtual void restore();
- virtual void restoreToCount(int saveCount);
+ virtual int getSaveCount() const override;
+ virtual int save(int flags) override;
+ virtual void restore() override;
+ virtual void restoreToCount(int saveCount) override;
- virtual void getMatrix(SkMatrix* outMatrix) const { mState.getMatrix(outMatrix); }
- virtual void setMatrix(const SkMatrix& matrix) { mState.setMatrix(matrix); }
- virtual void concatMatrix(const SkMatrix& matrix) { mState.concatMatrix(matrix); }
+ virtual void getMatrix(SkMatrix* outMatrix) const override { mState.getMatrix(outMatrix); }
+ virtual void setMatrix(const SkMatrix& matrix) override { mState.setMatrix(matrix); }
+ virtual void concatMatrix(const SkMatrix& matrix) override { mState.concatMatrix(matrix); }
- virtual void translate(float dx, float dy, float dz = 0.0f);
- virtual void rotate(float degrees);
- virtual void scale(float sx, float sy);
- virtual void skew(float sx, float sy);
+ virtual void translate(float dx, float dy, float dz = 0.0f) override;
+ virtual void rotate(float degrees) override;
+ virtual void scale(float sx, float sy) override;
+ virtual void skew(float sx, float sy) override;
void setMatrix(const Matrix4& matrix); // internal only convenience method
void concatMatrix(const Matrix4& matrix); // internal only convenience method
- virtual const Rect& getLocalClipBounds() const { return mState.getLocalClipBounds(); }
+ virtual const Rect& getLocalClipBounds() const override { return mState.getLocalClipBounds(); }
const Rect& getRenderTargetClipBounds() const { return mState.getRenderTargetClipBounds(); }
- virtual bool quickRejectConservative(float left, float top, float right, float bottom) const {
+ virtual bool quickRejectConservative(float left, float top,
+ float right, float bottom) const override {
return mState.quickRejectConservative(left, top, right, bottom);
}
- virtual bool clipRect(float left, float top, float right, float bottom, SkRegion::Op op);
- virtual bool clipPath(const SkPath* path, SkRegion::Op op);
- virtual bool clipRegion(const SkRegion* region, SkRegion::Op op);
+ virtual bool clipRect(float left, float top,
+ float right, float bottom, SkRegion::Op op) override;
+ virtual bool clipPath(const SkPath* path, SkRegion::Op op) override;
+ virtual bool clipRegion(const SkRegion* region, SkRegion::Op op) override;
/**
* Does not support different clipping Ops (that is, every call to setClippingOutline is
///////////////////////////////////////////////////////////////////
/// CanvasStateClient interface
- virtual void onViewportInitialized();
- virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored);
- virtual GLuint onGetTargetFbo() const { return 0; }
+ virtual void onViewportInitialized() override;
+ virtual void onSnapshotRestored(const Snapshot& removed, const Snapshot& restored) override;
+ virtual GLuint onGetTargetFbo() const override { return 0; }
SkPath* allocPathForFrame() {
SkPath* path = new SkPath();
void attachStencilBufferToLayer(Layer* layer);
bool quickRejectSetupScissor(float left, float top, float right, float bottom,
- const SkPaint* paint = NULL);
- bool quickRejectSetupScissor(const Rect& bounds, const SkPaint* paint = NULL) {
+ const SkPaint* paint = nullptr);
+ bool quickRejectSetupScissor(const Rect& bounds, const SkPaint* paint = nullptr) {
return quickRejectSetupScissor(bounds.left, bounds.top,
bounds.right, bounds.bottom, paint);
}
* null then null is returned.
*/
static inline SkColorFilter* getColorFilter(const SkPaint* paint) {
- return paint ? paint->getColorFilter() : NULL;
+ return paint ? paint->getColorFilter() : nullptr;
}
/**
* null then null is returned.
*/
static inline const SkShader* getShader(const SkPaint* paint) {
- return paint ? paint->getShader() : NULL;
+ return paint ? paint->getShader() : nullptr;
}
/**
* space must be scaled up and translated to fill the quad provided in (l,t,r,b). These
* transformations are stored in the modelView matrix and uploaded to the shader.
*
- * @param offset Set to true if the the matrix should be fudged (translated) slightly to disambiguate
- * geometry pixel positioning. See Vertex::GeometryFudgeFactor().
+ * @param offset Set to true if the the matrix should be fudged (translated) slightly to
+ * disambiguate geometry pixel positioning. See Vertex::GeometryFudgeFactor().
*
* @param ignoreTransform Set to true if l,t,r,b coordinates already in layer space,
* currentTransform() will be ignored. (e.g. when drawing clip in layer coordinates to stencil,
void setupDrawTextureTransform();
void setupDrawTextureTransformUniforms(mat4& transform);
void setupDrawTextGammaUniforms();
- void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords = NULL, GLuint vbo = 0);
+ void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords = nullptr, GLuint vbo = 0);
void setupDrawMesh(const GLvoid* vertices, const GLvoid* texCoords, const GLvoid* colors);
void setupDrawMeshIndices(const GLvoid* vertices, const GLvoid* texCoords, GLuint vbo = 0);
void setupDrawIndexedVertices(GLvoid* vertices);
}
const SkPath* getPath() const {
- if (mType == kOutlineType_None || mType == kOutlineType_Empty) return NULL;
+ if (mType == kOutlineType_None || mType == kOutlineType_Empty) return nullptr;
return &mPath;
}
namespace android {
namespace uirenderer {
-class TextureVertex;
+struct TextureVertex;
///////////////////////////////////////////////////////////////////////////////
// 9-patch structures
private:
struct PatchDescription {
- PatchDescription(): mPatch(NULL), mBitmapWidth(0), mBitmapHeight(0),
+ PatchDescription(): mPatch(nullptr), mBitmapWidth(0), mBitmapHeight(0),
mPixelWidth(0), mPixelHeight(0) {
}
* to track available regions of memory in the VBO.
*/
struct BufferBlock {
- BufferBlock(uint32_t offset, uint32_t size): offset(offset), size(size), next(NULL) {
+ BufferBlock(uint32_t offset, uint32_t size): offset(offset), size(size), next(nullptr) {
}
uint32_t offset;
}
void clearTask() {
- if (mTask != NULL) {
+ if (mTask != nullptr) {
mTask.clear();
}
}
* Used as a callback when an entry is removed from the cache.
* Do not invoke directly.
*/
- void operator()(PathDescription& path, PathTexture*& texture);
+ void operator()(PathDescription& path, PathTexture*& texture) override;
/**
* Clears the cache. This causes all textures to be deleted.
PathProcessor(Caches& caches);
~PathProcessor() { }
- virtual void onProcess(const sp<Task<SkBitmap*> >& task);
+ virtual void onProcess(const sp<Task<SkBitmap*> >& task) override;
private:
uint32_t mMaxTextureSize;
static inline DebugLevel readDebugLevel() {
char property[PROPERTY_VALUE_MAX];
- if (property_get(PROPERTY_DEBUG, property, NULL) > 0) {
+ if (property_get(PROPERTY_DEBUG, property, nullptr) > 0) {
return (DebugLevel) atoi(property);
}
return kDebugDisabled;
bottom = fmaxf(bottom, y);
}
- void dump(const char* label = NULL) const {
+ void dump(const char* label = nullptr) const {
ALOGD("%s[l=%f t=%f r=%f b=%f]", label ? label : "Rect", left, top, right, bottom);
}
private:
struct RenderBufferEntry {
RenderBufferEntry():
- mBuffer(NULL), mWidth(0), mHeight(0) {
+ mBuffer(nullptr), mWidth(0), mHeight(0) {
}
RenderBufferEntry(GLenum format, const uint32_t width, const uint32_t height):
- mBuffer(NULL), mFormat(format), mWidth(width), mHeight(height) {
+ mBuffer(nullptr), mFormat(format), mWidth(width), mHeight(height) {
}
RenderBufferEntry(RenderBuffer* buffer):
if (matrix) {
mStaticMatrix = new SkMatrix(*matrix);
} else {
- mStaticMatrix = NULL;
+ mStaticMatrix = nullptr;
}
return true;
}
if (matrix) {
mAnimationMatrix = new SkMatrix(*matrix);
} else {
- mAnimationMatrix = NULL;
+ mAnimationMatrix = nullptr;
}
return true;
}
bool hasShadow() const {
return getZ() > 0.0f
- && getOutline().getPath() != NULL
+ && getOutline().getPath() != nullptr
&& getOutline().getAlpha() != 0.0f;
}
// TODO: move to a method on android:Paint
static inline bool paintWillNotDrawText(const SkPaint& paint) {
return paint.getAlpha() == 0
- && paint.getLooper() == NULL
+ && paint.getLooper() == nullptr
&& !paint.getColorFilter()
&& getXfermode(paint.getXfermode()) == SkXfermode::kSrcOver_Mode;
}
static bool isBlendedColorFilter(const SkColorFilter* filter) {
- if (filter == NULL) {
+ if (filter == nullptr) {
return false;
}
return (filter->getFlags() & SkColorFilter::kAlphaUnchanged_Flag) == 0;
float getRadius() const { return mRadius; }
const SkPath* getPath() const {
- if (!mShouldClip) return NULL;
+ if (!mShouldClip) return nullptr;
return &mPath;
}
sp<TaskProcessor<VertexBuffer*> > mProcessor;
LruCache<Description, Buffer*> mCache;
class BufferRemovedListener : public OnEntryRemoved<Description, Buffer*> {
- void operator()(Description& description, Buffer*& buffer);
+ void operator()(Description& description, Buffer*& buffer) override;
};
BufferRemovedListener mBufferRemovedListener;
// holds a pointer, and implicit strong ref to each shadow task of the frame
LruCache<ShadowDescription, Task<vertexBuffer_pair_t*>*> mShadowCache;
class BufferPairRemovedListener : public OnEntryRemoved<ShadowDescription, Task<vertexBuffer_pair_t*>*> {
- void operator()(ShadowDescription& description, Task<vertexBuffer_pair_t*>*& bufferPairTask) {
- bufferPairTask->decStrong(NULL);
+ void operator()(ShadowDescription& description, Task<vertexBuffer_pair_t*>*& bufferPairTask) override {
+ bufferPairTask->decStrong(nullptr);
}
};
BufferPairRemovedListener mBufferPairRemovedListener;
class FontRenderer;
struct ShadowText {
- ShadowText(): len(0), radius(0.0f), textSize(0.0f), typeface(NULL),
- flags(0), italicStyle(0.0f), scaleX(0), text(NULL), positions(NULL) {
+ ShadowText(): len(0), radius(0.0f), textSize(0.0f), typeface(nullptr),
+ flags(0), italicStyle(0.0f), scaleX(0), text(nullptr), positions(nullptr) {
}
// len is the number of bytes in text
uint32_t charCount = len / sizeof(char16_t);
str.setTo((const char16_t*) text, charCount);
text = str.string();
- if (positions != NULL) {
+ if (positions != nullptr) {
positionsCopy.clear();
positionsCopy.appendArray(positions, charCount * 2);
positions = positionsCopy.array();
* Used as a callback when an entry is removed from the cache.
* Do not invoke directly.
*/
- void operator()(ShadowText& text, ShadowTexture*& texture);
+ void operator()(ShadowText& text, ShadowTexture*& texture) override;
ShadowTexture* get(const SkPaint* paint, const char* text, uint32_t len,
int numGlyphs, float radius, const float* positions);
* Used as a callback when an entry is removed from the cache.
* Do not invoke directly.
*/
- void operator()(uint32_t&, Texture*& texture);
+ void operator()(uint32_t&, Texture*& texture) override;
/**
* Resets all Textures to not be marked as in use
};
VertexBuffer()
- : mBuffer(0)
- , mIndices(0)
+ : mBuffer(nullptr)
+ , mIndices(nullptr)
, mVertexCount(0)
, mIndexCount(0)
, mAllocatedVertexCount(0)
, mAllocatedIndexCount(0)
, mByteCount(0)
, mMode(kStandard)
- , mReallocBuffer(0)
- , mCleanupMethod(NULL)
- , mCleanupIndexMethod(NULL)
+ , mReallocBuffer(nullptr)
+ , mCleanupMethod(nullptr)
+ , mCleanupIndexMethod(nullptr)
{}
~VertexBuffer() {
CacheBlock* mPrev;
CacheBlock(uint16_t x, uint16_t y, uint16_t width, uint16_t height):
- mX(x), mY(y), mWidth(width), mHeight(height), mNext(NULL), mPrev(NULL) {
+ mX(x), mY(y), mWidth(width), mHeight(height), mNext(nullptr), mPrev(nullptr) {
}
static CacheBlock* insertBlock(CacheBlock* head, CacheBlock* newBlock);
}
uint16_t* indices() const {
- return (uint16_t*) 0;
+ return (uint16_t*) nullptr;
}
void resetMesh() {
// Font
///////////////////////////////////////////////////////////////////////////////
-class CachedGlyphInfo;
+struct CachedGlyphInfo;
class CacheTexture;
class FontRenderer;
void measure(const SkPaint* paint, const char* text, uint32_t start, uint32_t len,
int numGlyphs, Rect *bounds, const float* positions);
- void invalidateTextureCache(CacheTexture* cacheTexture = NULL);
+ void invalidateTextureCache(CacheTexture* cacheTexture = nullptr);
CachedGlyphInfo* cacheGlyph(const SkPaint* paint, glyph_t glyph, bool precaching);
void updateGlyphCache(const SkPaint* paint, const SkGlyph& skiaGlyph,
void exit();
private:
- virtual status_t readyToRun();
- virtual bool threadLoop();
+ virtual status_t readyToRun() override;
+ virtual bool threadLoop() override;
// Lock for the list of tasks
mutable Mutex mLock;
virtual void onProcess(const sp<Task<T> >& task) = 0;
private:
- virtual void process(const sp<TaskBase>& task) {
+ virtual void process(const sp<TaskBase>& task) override {
sp<Task<T> > realTask = static_cast<Task<T>* >(task.get());
// This is the right way to do it but sp<> doesn't play nice
// sp<Task<T> > realTask = static_cast<sp<Task<T> > >(task);
}
protected:
- virtual void do_construct(void* storage, size_t num) const;
- virtual void do_destroy(void* storage, size_t num) const;
- virtual void do_copy(void* dest, const void* from, size_t num) const;
- virtual void do_splat(void* dest, const void* item, size_t num) const;
- virtual void do_move_forward(void* dest, const void* from, size_t num) const;
- virtual void do_move_backward(void* dest, const void* from, size_t num) const;
- virtual int do_compare(const void* lhs, const void* rhs) const;
+ virtual void do_construct(void* storage, size_t num) const override;
+ virtual void do_destroy(void* storage, size_t num) const override;
+ virtual void do_copy(void* dest, const void* from, size_t num) const override;
+ virtual void do_splat(void* dest, const void* item, size_t num) const override;
+ virtual void do_move_forward(void* dest, const void* from, size_t num) const override;
+ virtual void do_move_backward(void* dest, const void* from, size_t num) const override;
+ virtual int do_compare(const void* lhs, const void* rhs) const override;
}; // class SortedList
///////////////////////////////////////////////////////////////////////////////
virtual int do_compare(const void* lhs, const void* rhs) const = 0;
private:
- ssize_t _indexOrderOf(const void* item, size_t* order = 0) const;
+ ssize_t _indexOrderOf(const void* item, size_t* order = nullptr) const;
// these are made private, because they can't be used on a SortedVector
// (they don't have an implementation either)