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

Unified Diff: src/gpu/GrAtlasTextContext.h

Issue 1062863002: Avoid regenerating cached textblobs on integer scrolls (Closed) Base URL: https://skia.googlesource.com/skia.git@atlastextcache
Patch Set: some sleight bug fixes Created 5 years, 8 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: src/gpu/GrAtlasTextContext.h
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h
index 86810ff21b6209703a2368b6fb6efffaf7458416..2f4779f03c7aa723ac58b09b54f325ebc119fe6c 100644
--- a/src/gpu/GrAtlasTextContext.h
+++ b/src/gpu/GrAtlasTextContext.h
@@ -13,12 +13,13 @@
#include "GrBatchAtlas.h"
#include "GrGeometryProcessor.h"
#include "SkDescriptor.h"
+#include "GrMemoryPool.h"
#include "SkTextBlob.h"
-#include "SkTDynamicHash.h"
#include "SkTInternalLList.h"
class GrBatchTextStrike;
class GrPipelineBuilder;
+class GrTextBlobCache;
/*
* This class implements GrTextContext using standard bitmap fonts, and can also process textblobs.
@@ -28,8 +29,6 @@ class GrAtlasTextContext : public GrTextContext {
public:
static GrAtlasTextContext* Create(GrContext*, SkGpuDevice*, const SkDeviceProperties&);
- virtual ~GrAtlasTextContext();
-
private:
GrAtlasTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&);
@@ -126,13 +125,13 @@ private:
};
SkTArray<BigGlyph> fBigGlyphs;
+ GrColor fColor; // the original color on the paint
SkMatrix fViewMatrix;
SkScalar fX;
SkScalar fY;
SkPaint::Style fStyle;
int fRunCount;
uint32_t fUniqueID;
- size_t fSize;
GrMemoryPool* fPool;
// all glyph / vertex offsets are into these pools.
@@ -166,8 +165,6 @@ private:
typedef BitmapTextBlob::Run Run;
typedef Run::SubRunInfo PerSubRunInfo;
- BitmapTextBlob* CreateBlob(int glyphCount, int runCount, GrMemoryPool*);
-
void appendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int left, int top,
GrColor color, GrFontScaler*, const SkIRect& clipRect);
@@ -175,14 +172,15 @@ private:
const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x,
SkScalar y);
inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int run, GrColor,
- uint8_t paintAlpha);
+ uint8_t paintAlpha, SkScalar transX, SkScalar transY);
inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt,
- const GrPaint& grPaint, const GrClip& clip);
+ const GrPaint& grPaint, const GrClip& clip,
+ SkScalar transX, SkScalar transY);
// We have to flush SkTextBlobs differently from drawText / drawPosText
void flush(GrDrawTarget*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&,
const GrPaint&, SkDrawFilter*, const GrClip&, const SkMatrix& viewMatrix,
- const SkIRect& clipBounds, SkScalar x, SkScalar y);
+ const SkIRect& clipBounds, SkScalar x, SkScalar y, SkScalar transX, SkScalar transY);
void flush(GrDrawTarget*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&,
const GrPaint&, const GrClip&, const SkMatrix& viewMatrix);
@@ -197,18 +195,15 @@ private:
// sets up the descriptor on the blob and returns a detached cache. Client must attach
inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix& viewMatrix);
- static inline bool MustRegenerateBlob(const BitmapTextBlob&, const SkPaint&,
+ static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTransY,
+ const BitmapTextBlob&, const SkPaint&,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y);
void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, const SkMatrix& viewMatrix,
const SkTextBlob* blob, SkScalar x, SkScalar y,
SkDrawFilter* drawFilter, const SkIRect& clipRect);
- // TODO this currently only uses the public interface of SkTextBlob, however, I may need to add
- // functionality to it while looping over the runs so I'm putting this here for the time being.
- // If this lands in Chrome without changes, move it to SkTextBlob.
- static inline void BlobGlyphCount(int* glyphCount, int* runCount, const SkTextBlob*);
-
GrBatchTextStrike* fCurrStrike;
+ GrTextBlobCache* fCache;
friend class GrTextBlobCache;
friend class BitmapTextBatch;

Powered by Google App Engine
This is Rietveld 408576698