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

Unified Diff: src/gpu/GrStencilAndCoverTextContext.cpp

Issue 1015173002: Let text contexts fall back directly to paths (Closed) Base URL: https://skia.googlesource.com/skia.git@text-blob-to-context
Patch Set: move createTextContext to private Created 5 years, 9 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
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrStencilAndCoverTextContext.cpp
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index ec2fa21af0a1604861a4df6e78fdb430e20c657c..db41c02239b0ad3245489c85d7270371070207d8 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -20,19 +20,21 @@
#include "SkTextMapStateProc.h"
#include "SkTextFormatParams.h"
-GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(
- GrContext* context, const SkDeviceProperties& properties)
- : GrTextContext(context, properties)
+GrStencilAndCoverTextContext::GrStencilAndCoverTextContext(GrContext* context,
+ SkGpuDevice* gpuDevice,
+ const SkDeviceProperties& properties)
+ : GrTextContext(context, gpuDevice, properties)
, fStroke(SkStrokeRec::kFill_InitStyle)
, fQueuedGlyphCount(0)
, fFallbackGlyphsIdx(kGlyphBufferSize) {
}
-GrStencilAndCoverTextContext* GrStencilAndCoverTextContext::Create(GrContext* context,
- const SkDeviceProperties& props) {
+GrStencilAndCoverTextContext*
+GrStencilAndCoverTextContext::Create(GrContext* context, SkGpuDevice* gpuDevice,
+ const SkDeviceProperties& props) {
GrStencilAndCoverTextContext* textContext = SkNEW_ARGS(GrStencilAndCoverTextContext,
- (context, props));
- textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, props);
+ (context, gpuDevice, props));
+ textContext->fFallbackTextContext = GrBitmapTextContext::Create(context, gpuDevice, props);
return textContext;
}
@@ -71,7 +73,8 @@ void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt,
const SkMatrix& viewMatrix,
const char text[],
size_t byteLength,
- SkScalar x, SkScalar y) {
+ SkScalar x, SkScalar y,
+ const SkIRect& regionClipBounds) {
SkASSERT(byteLength == 0 || text != NULL);
if (text == NULL || byteLength == 0 /*|| fRC->isEmpty()*/) {
@@ -93,7 +96,8 @@ void GrStencilAndCoverTextContext::onDrawText(GrRenderTarget* rt,
// will turn off the use of device-space glyphs when perspective transforms
// are in use.
- this->init(rt, clip, paint, skPaint, byteLength, kMaxAccuracy_RenderMode, viewMatrix);
+ this->init(rt, clip, paint, skPaint, byteLength, kMaxAccuracy_RenderMode, viewMatrix,
+ regionClipBounds);
// Transform our starting point.
if (fUsingDeviceSpaceGlyphs) {
@@ -164,7 +168,8 @@ void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt,
size_t byteLength,
const SkScalar pos[],
int scalarsPerPosition,
- const SkPoint& offset) {
+ const SkPoint& offset,
+ const SkIRect& regionClipBounds) {
SkASSERT(byteLength == 0 || text != NULL);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
@@ -181,7 +186,8 @@ void GrStencilAndCoverTextContext::onDrawPosText(GrRenderTarget* rt,
// transform is not part of SkPaint::measureText API, and thus we use the
// same glyphs as what were measured.
- this->init(rt, clip, paint, skPaint, byteLength, kMaxPerformance_RenderMode, viewMatrix);
+ this->init(rt, clip, paint, skPaint, byteLength, kMaxPerformance_RenderMode, viewMatrix,
+ regionClipBounds);
SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc();
@@ -239,8 +245,9 @@ void GrStencilAndCoverTextContext::init(GrRenderTarget* rt,
const SkPaint& skPaint,
size_t textByteLength,
RenderMode renderMode,
- const SkMatrix& viewMatrix) {
- GrTextContext::init(rt, clip, paint, skPaint);
+ const SkMatrix& viewMatrix,
+ const SkIRect& regionClipBounds) {
+ GrTextContext::init(rt, clip, paint, skPaint, regionClipBounds);
fContextInitialMatrix = viewMatrix;
fViewMatrix = viewMatrix;
@@ -449,7 +456,7 @@ void GrStencilAndCoverTextContext::flush() {
fViewMatrix, (char*)&fGlyphIndices[fFallbackGlyphsIdx],
2 * fallbackGlyphCount,
get_xy_scalar_array(&fGlyphPositions[fFallbackGlyphsIdx]),
- 2, SkPoint::Make(0, 0));
+ 2, SkPoint::Make(0, 0), fRegionClipBounds);
fFallbackGlyphsIdx = kGlyphBufferSize;
}
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698