Use const where possible for drawing parameters
They should never be modified by a Renderer, only read and copied.
Change-Id: I9d8d55dca19115ee9dfeb2bb3f092ba2fb327cd4
diff --git a/libs/hwui/FontRenderer.h b/libs/hwui/FontRenderer.h
index db4e020..9259028 100644
--- a/libs/hwui/FontRenderer.h
+++ b/libs/hwui/FontRenderer.h
@@ -62,7 +62,7 @@
};
TextSetupFunctor(OpenGLRenderer* renderer, float x, float y, bool pureTranslate,
- int alpha, SkXfermode::Mode mode, SkPaint* paint): Functor(),
+ int alpha, SkXfermode::Mode mode, const SkPaint* paint): Functor(),
renderer(renderer), x(x), y(y), pureTranslate(pureTranslate),
alpha(alpha), mode(mode), paint(paint) {
}
@@ -76,7 +76,7 @@
bool pureTranslate;
int alpha;
SkXfermode::Mode mode;
- SkPaint* paint;
+ const SkPaint* paint;
};
///////////////////////////////////////////////////////////////////////////////
@@ -95,20 +95,20 @@
mGammaTable = gammaTable;
}
- void setFont(SkPaint* paint, const mat4& matrix);
+ void setFont(const SkPaint* paint, const mat4& matrix);
- void precache(SkPaint* paint, const char* text, int numGlyphs, const mat4& matrix);
+ void precache(const SkPaint* paint, const char* text, int numGlyphs, const mat4& matrix);
void endPrecaching();
// bounds is an out parameter
- bool renderPosText(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex,
- uint32_t len, int numGlyphs, int x, int y, const float* positions, Rect* bounds,
- Functor* functor, bool forceFinish = true);
+ bool renderPosText(const SkPaint* paint, const Rect* clip, const char *text,
+ uint32_t startIndex, uint32_t len, int numGlyphs, int x, int y, const float* positions,
+ Rect* bounds, Functor* functor, bool forceFinish = true);
// bounds is an out parameter
- bool renderTextOnPath(SkPaint* paint, const Rect* clip, const char *text, uint32_t startIndex,
- uint32_t len, int numGlyphs, SkPath* path, float hOffset, float vOffset, Rect* bounds,
- Functor* functor);
+ bool renderTextOnPath(const SkPaint* paint, const Rect* clip, const char *text,
+ uint32_t startIndex, uint32_t len, int numGlyphs, const SkPath* path,
+ float hOffset, float vOffset, Rect* bounds, Functor* functor);
struct DropShadow {
DropShadow() { };
@@ -128,7 +128,7 @@
// After renderDropShadow returns, the called owns the memory in DropShadow.image
// and is responsible for releasing it when it's done with it
- DropShadow renderDropShadow(SkPaint* paint, const char *text, uint32_t startIndex,
+ DropShadow renderDropShadow(const SkPaint* paint, const char *text, uint32_t startIndex,
uint32_t len, int numGlyphs, uint32_t radius, const float* positions);
void setTextureFiltering(bool linearFiltering) {