Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: include/core/SkPaint.h

Issue 245953003: Test font created from paint (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/core/SkPaint.h
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 95fc0b87ad0be45dc85cd0569849c24e766d50d6..c750d0da322fe5aae9a56a5e2a0ceaf8e0cb0eb2 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -13,6 +13,7 @@
#include "SkColor.h"
#include "SkDrawLooper.h"
+#include "SkFont.h"
#include "SkMatrix.h"
#include "SkXfermode.h"
#ifdef SK_BUILD_FOR_ANDROID
@@ -1036,7 +1037,11 @@ public:
static void Unflatten(SkReadBuffer& buffer, SkPaint* paint);
};
+ SkFont* testing_getCachedFont() { return this->getCachedFont(); }
+
private:
+ SkFont* fCachedFont;
+
SkTypeface* fTypeface;
SkPathEffect* fPathEffect;
SkShader* fShader;
@@ -1074,6 +1079,19 @@ private:
uint32_t getBitfields() const { return fBitfields; }
void setBitfields(uint32_t bitfields);
+ SkFont* getCachedFont() {
+ if (NULL == fCachedFont) {
+ fCachedFont = SkFont::Testing_CreateFromPaint(*this);
+ }
+ return fCachedFont;
+ }
+ void dirtyCachedFont(bool somethingChanged) {
+ if (somethingChanged && fCachedFont) {
+ fCachedFont->unref();
+ fCachedFont = NULL;
+ }
+ }
+
SkDrawCacheProc getDrawCacheProc() const;
SkMeasureCacheProc getMeasureCacheProc(TextBufferDirection dir,
bool needFullMetrics) const;

Powered by Google App Engine
This is Rietveld 408576698