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

Side by Side Diff: src/gpu/SkGpuDevice.cpp

Issue 1316233002: Style Change: NULL->nullptr (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-27 (Thursday) 10:25:06 EDT Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGpuDevice.h" 8 #include "SkGpuDevice.h"
9 9
10 #include "GrBlurUtils.h" 10 #include "GrBlurUtils.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 SkASSERT(texture); 93 SkASSERT(texture);
94 *texture = this->set(context, bitmap, params); 94 *texture = this->set(context, bitmap, params);
95 } 95 }
96 96
97 GrTexture* set(GrContext* context, 97 GrTexture* set(GrContext* context,
98 const SkBitmap& bitmap, 98 const SkBitmap& bitmap,
99 const GrTextureParams* params) { 99 const GrTextureParams* params) {
100 // Either get the texture directly from the bitmap, or else use the cach e and 100 // Either get the texture directly from the bitmap, or else use the cach e and
101 // remember to unref it. 101 // remember to unref it.
102 if (GrTexture* bmpTexture = bitmap.getTexture()) { 102 if (GrTexture* bmpTexture = bitmap.getTexture()) {
103 fTexture.reset(NULL); 103 fTexture.reset(nullptr);
104 return bmpTexture; 104 return bmpTexture;
105 } else { 105 } else {
106 fTexture.reset(GrRefCachedBitmapTexture(context, bitmap, params)); 106 fTexture.reset(GrRefCachedBitmapTexture(context, bitmap, params));
107 return fTexture.get(); 107 return fTexture.get();
108 } 108 }
109 } 109 }
110 110
111 private: 111 private:
112 SkAutoTUnref<GrTexture> fTexture; 112 SkAutoTUnref<GrTexture> fTexture;
113 }; 113 };
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, const SkSurfaceProps* props , 148 SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, const SkSurfaceProps* props ,
149 InitContents init) { 149 InitContents init) {
150 return SkGpuDevice::Create(rt, rt->width(), rt->height(), props, init); 150 return SkGpuDevice::Create(rt, rt->width(), rt->height(), props, init);
151 } 151 }
152 152
153 SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, int width, int height, 153 SkGpuDevice* SkGpuDevice::Create(GrRenderTarget* rt, int width, int height,
154 const SkSurfaceProps* props, InitContents init) { 154 const SkSurfaceProps* props, InitContents init) {
155 if (!rt || rt->wasDestroyed()) { 155 if (!rt || rt->wasDestroyed()) {
156 return NULL; 156 return nullptr;
157 } 157 }
158 unsigned flags; 158 unsigned flags;
159 if (!CheckAlphaTypeAndGetFlags(NULL, init, &flags)) { 159 if (!CheckAlphaTypeAndGetFlags(nullptr, init, &flags)) {
160 return NULL; 160 return nullptr;
161 } 161 }
162 return new SkGpuDevice(rt, width, height, props, flags); 162 return new SkGpuDevice(rt, width, height, props, flags);
163 } 163 }
164 164
165 SkGpuDevice* SkGpuDevice::Create(GrContext* context, SkSurface::Budgeted budgete d, 165 SkGpuDevice* SkGpuDevice::Create(GrContext* context, SkSurface::Budgeted budgete d,
166 const SkImageInfo& info, int sampleCount, 166 const SkImageInfo& info, int sampleCount,
167 const SkSurfaceProps* props, InitContents init) { 167 const SkSurfaceProps* props, InitContents init) {
168 unsigned flags; 168 unsigned flags;
169 if (!CheckAlphaTypeAndGetFlags(&info, init, &flags)) { 169 if (!CheckAlphaTypeAndGetFlags(&info, init, &flags)) {
170 return NULL; 170 return nullptr;
171 } 171 }
172 172
173 SkAutoTUnref<GrRenderTarget> rt(CreateRenderTarget(context, budgeted, info, sampleCount)); 173 SkAutoTUnref<GrRenderTarget> rt(CreateRenderTarget(context, budgeted, info, sampleCount));
174 if (NULL == rt) { 174 if (nullptr == rt) {
175 return NULL; 175 return nullptr;
176 } 176 }
177 177
178 return new SkGpuDevice(rt, info.width(), info.height(), props, flags); 178 return new SkGpuDevice(rt, info.width(), info.height(), props, flags);
179 } 179 }
180 180
181 SkGpuDevice::SkGpuDevice(GrRenderTarget* rt, int width, int height, 181 SkGpuDevice::SkGpuDevice(GrRenderTarget* rt, int width, int height,
182 const SkSurfaceProps* props, unsigned flags) 182 const SkSurfaceProps* props, unsigned flags)
183 : INHERITED(SkSurfacePropsCopyOrDefault(props)) 183 : INHERITED(SkSurfacePropsCopyOrDefault(props))
184 { 184 {
185 fDrawProcs = NULL; 185 fDrawProcs = nullptr;
186 186
187 fContext = SkRef(rt->getContext()); 187 fContext = SkRef(rt->getContext());
188 fNeedClear = SkToBool(flags & kNeedClear_Flag); 188 fNeedClear = SkToBool(flags & kNeedClear_Flag);
189 fOpaque = SkToBool(flags & kIsOpaque_Flag); 189 fOpaque = SkToBool(flags & kIsOpaque_Flag);
190 190
191 fRenderTarget = SkRef(rt); 191 fRenderTarget = SkRef(rt);
192 192
193 SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType; 193 SkAlphaType at = fOpaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
194 SkImageInfo info = rt->surfacePriv().info(at).makeWH(width, height); 194 SkImageInfo info = rt->surfacePriv().info(at).makeWH(width, height);
195 SkPixelRef* pr = new SkGrPixelRef(info, rt); 195 SkPixelRef* pr = new SkGrPixelRef(info, rt);
196 fLegacyBitmap.setInfo(info); 196 fLegacyBitmap.setInfo(info);
197 fLegacyBitmap.setPixelRef(pr)->unref(); 197 fLegacyBitmap.setPixelRef(pr)->unref();
198 198
199 fDrawContext.reset(SkRef(fContext->drawContext(&this->surfaceProps()))); 199 fDrawContext.reset(SkRef(fContext->drawContext(&this->surfaceProps())));
200 } 200 }
201 201
202 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B udgeted budgeted, 202 GrRenderTarget* SkGpuDevice::CreateRenderTarget(GrContext* context, SkSurface::B udgeted budgeted,
203 const SkImageInfo& origInfo, int sampleCount) { 203 const SkImageInfo& origInfo, int sampleCount) {
204 if (kUnknown_SkColorType == origInfo.colorType() || 204 if (kUnknown_SkColorType == origInfo.colorType() ||
205 origInfo.width() < 0 || origInfo.height() < 0) { 205 origInfo.width() < 0 || origInfo.height() < 0) {
206 return NULL; 206 return nullptr;
207 } 207 }
208 208
209 if (!context) { 209 if (!context) {
210 return NULL; 210 return nullptr;
211 } 211 }
212 212
213 SkColorType ct = origInfo.colorType(); 213 SkColorType ct = origInfo.colorType();
214 SkAlphaType at = origInfo.alphaType(); 214 SkAlphaType at = origInfo.alphaType();
215 if (kRGB_565_SkColorType == ct) { 215 if (kRGB_565_SkColorType == ct) {
216 at = kOpaque_SkAlphaType; // force this setting 216 at = kOpaque_SkAlphaType; // force this setting
217 } else if (ct != kBGRA_8888_SkColorType && ct != kRGBA_8888_SkColorType) { 217 } else if (ct != kBGRA_8888_SkColorType && ct != kRGBA_8888_SkColorType) {
218 // Fall back from whatever ct was to default of kRGBA or kBGRA which is aliased as kN32 218 // Fall back from whatever ct was to default of kRGBA or kBGRA which is aliased as kN32
219 ct = kN32_SkColorType; 219 ct = kN32_SkColorType;
220 } 220 }
221 if (kOpaque_SkAlphaType != at) { 221 if (kOpaque_SkAlphaType != at) {
222 at = kPremul_SkAlphaType; // force this setting 222 at = kPremul_SkAlphaType; // force this setting
223 } 223 }
224 const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height (), ct, at); 224 const SkImageInfo info = SkImageInfo::Make(origInfo.width(), origInfo.height (), ct, at);
225 225
226 GrSurfaceDesc desc; 226 GrSurfaceDesc desc;
227 desc.fFlags = kRenderTarget_GrSurfaceFlag; 227 desc.fFlags = kRenderTarget_GrSurfaceFlag;
228 desc.fWidth = info.width(); 228 desc.fWidth = info.width();
229 desc.fHeight = info.height(); 229 desc.fHeight = info.height();
230 desc.fConfig = SkImageInfo2GrPixelConfig(info); 230 desc.fConfig = SkImageInfo2GrPixelConfig(info);
231 desc.fSampleCnt = sampleCount; 231 desc.fSampleCnt = sampleCount;
232 GrTexture* texture = context->textureProvider()->createTexture( 232 GrTexture* texture = context->textureProvider()->createTexture(
233 desc, SkToBool(budgeted), NULL, 0); 233 desc, SkToBool(budgeted), nullptr, 0);
234 if (NULL == texture) { 234 if (nullptr == texture) {
235 return NULL; 235 return nullptr;
236 } 236 }
237 SkASSERT(NULL != texture->asRenderTarget()); 237 SkASSERT(nullptr != texture->asRenderTarget());
238 return texture->asRenderTarget(); 238 return texture->asRenderTarget();
239 } 239 }
240 240
241 SkGpuDevice::~SkGpuDevice() { 241 SkGpuDevice::~SkGpuDevice() {
242 if (fDrawProcs) { 242 if (fDrawProcs) {
243 delete fDrawProcs; 243 delete fDrawProcs;
244 } 244 }
245 245
246 fRenderTarget->unref(); 246 fRenderTarget->unref();
247 fContext->unref(); 247 fContext->unref();
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) { 303 void SkGpuDevice::onAttachToCanvas(SkCanvas* canvas) {
304 INHERITED::onAttachToCanvas(canvas); 304 INHERITED::onAttachToCanvas(canvas);
305 305
306 // Canvas promises that this ptr is valid until onDetachFromCanvas is called 306 // Canvas promises that this ptr is valid until onDetachFromCanvas is called
307 fClipStack.reset(SkRef(canvas->getClipStack())); 307 fClipStack.reset(SkRef(canvas->getClipStack()));
308 } 308 }
309 309
310 void SkGpuDevice::onDetachFromCanvas() { 310 void SkGpuDevice::onDetachFromCanvas() {
311 INHERITED::onDetachFromCanvas(); 311 INHERITED::onDetachFromCanvas();
312 fClip.reset(); 312 fClip.reset();
313 fClipStack.reset(NULL); 313 fClipStack.reset(nullptr);
314 } 314 }
315 315
316 // call this every draw call, to ensure that the context reflects our state, 316 // call this every draw call, to ensure that the context reflects our state,
317 // and not the state from some other canvas/device 317 // and not the state from some other canvas/device
318 void SkGpuDevice::prepareDraw(const SkDraw& draw) { 318 void SkGpuDevice::prepareDraw(const SkDraw& draw) {
319 SkASSERT(fClipStack.get()); 319 SkASSERT(fClipStack.get());
320 320
321 SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack); 321 SkASSERT(draw.fClipStack && draw.fClipStack == fClipStack);
322 322
323 fClip.setClipStack(fClipStack, &this->getOrigin()); 323 fClip.setClipStack(fClipStack, &this->getOrigin());
(...skipping 18 matching lines...) Expand all
342 // Caller must have accessed the render target, because it knows the rt must be replaced. 342 // Caller must have accessed the render target, because it knows the rt must be replaced.
343 SkASSERT(!fNeedClear); 343 SkASSERT(!fNeedClear);
344 344
345 SkSurface::Budgeted budgeted = 345 SkSurface::Budgeted budgeted =
346 fRenderTarget->resourcePriv().isBudgeted() ? SkSurface::kYes_Budgete d 346 fRenderTarget->resourcePriv().isBudgeted() ? SkSurface::kYes_Budgete d
347 : SkSurface::kNo_Budgeted ; 347 : SkSurface::kNo_Budgeted ;
348 348
349 SkAutoTUnref<GrRenderTarget> newRT(CreateRenderTarget( 349 SkAutoTUnref<GrRenderTarget> newRT(CreateRenderTarget(
350 fRenderTarget->getContext(), budgeted, this->imageInfo(), fRenderTarget- >desc().fSampleCnt)); 350 fRenderTarget->getContext(), budgeted, this->imageInfo(), fRenderTarget- >desc().fSampleCnt));
351 351
352 if (NULL == newRT) { 352 if (nullptr == newRT) {
353 return; 353 return;
354 } 354 }
355 355
356 if (shouldRetainContent) { 356 if (shouldRetainContent) {
357 if (fRenderTarget->wasDestroyed()) { 357 if (fRenderTarget->wasDestroyed()) {
358 return; 358 return;
359 } 359 }
360 this->context()->copySurface(newRT, fRenderTarget); 360 this->context()->copySurface(newRT, fRenderTarget);
361 } 361 }
362 362
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 return; 457 return;
458 } 458 }
459 459
460 fDrawContext->drawVertices(fRenderTarget, 460 fDrawContext->drawVertices(fRenderTarget,
461 fClip, 461 fClip,
462 grPaint, 462 grPaint,
463 *draw.fMatrix, 463 *draw.fMatrix,
464 gPointMode2PrimtiveType[mode], 464 gPointMode2PrimtiveType[mode],
465 SkToS32(count), 465 SkToS32(count),
466 (SkPoint*)pts, 466 (SkPoint*)pts,
467 NULL, 467 nullptr,
468 NULL, 468 nullptr,
469 NULL, 469 nullptr,
470 0); 470 0);
471 } 471 }
472 472
473 /////////////////////////////////////////////////////////////////////////////// 473 ///////////////////////////////////////////////////////////////////////////////
474 474
475 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect, 475 void SkGpuDevice::drawRect(const SkDraw& draw, const SkRect& rect,
476 const SkPaint& paint) { 476 const SkPaint& paint) {
477 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRect", fContext); 477 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawRect", fContext);
478 478
479 CHECK_FOR_ANNOTATION(paint); 479 CHECK_FOR_ANNOTATION(paint);
(...skipping 24 matching lines...) Expand all
504 504
505 const SkPathEffect* pe = paint.getPathEffect(); 505 const SkPathEffect* pe = paint.getPathEffect();
506 if (!usePath && pe && !strokeInfo.isDashed()) { 506 if (!usePath && pe && !strokeInfo.isDashed()) {
507 usePath = true; 507 usePath = true;
508 } 508 }
509 509
510 if (usePath) { 510 if (usePath) {
511 SkPath path; 511 SkPath path;
512 path.setIsVolatile(true); 512 path.setIsVolatile(true);
513 path.addRect(rect); 513 path.addRect(rect);
514 this->drawPath(draw, path, paint, NULL, true); 514 this->drawPath(draw, path, paint, nullptr, true);
515 return; 515 return;
516 } 516 }
517 517
518 GrPaint grPaint; 518 GrPaint grPaint;
519 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 519 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) {
520 return; 520 return;
521 } 521 }
522 522
523 fDrawContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, & strokeInfo); 523 fDrawContext->drawRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, & strokeInfo);
524 } 524 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 if (pe && !strokeInfo.isDashed()) { 580 if (pe && !strokeInfo.isDashed()) {
581 usePath = true; 581 usePath = true;
582 } 582 }
583 } 583 }
584 584
585 585
586 if (usePath) { 586 if (usePath) {
587 SkPath path; 587 SkPath path;
588 path.setIsVolatile(true); 588 path.setIsVolatile(true);
589 path.addRRect(rect); 589 path.addRRect(rect);
590 this->drawPath(draw, path, paint, NULL, true); 590 this->drawPath(draw, path, paint, nullptr, true);
591 return; 591 return;
592 } 592 }
593 593
594 fDrawContext->drawRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, strokeInfo); 594 fDrawContext->drawRRect(fRenderTarget, fClip, grPaint, *draw.fMatrix, rect, strokeInfo);
595 } 595 }
596 596
597 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, 597 void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer,
598 const SkRRect& inner, const SkPaint& paint) { 598 const SkRRect& inner, const SkPaint& paint) {
599 SkStrokeRec stroke(paint); 599 SkStrokeRec stroke(paint);
600 if (stroke.isFillStyle()) { 600 if (stroke.isFillStyle()) {
601 601
602 CHECK_FOR_ANNOTATION(paint); 602 CHECK_FOR_ANNOTATION(paint);
603 CHECK_SHOULD_DRAW(draw); 603 CHECK_SHOULD_DRAW(draw);
604 604
605 GrPaint grPaint; 605 GrPaint grPaint;
606 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri x, true, 606 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatri x, true,
607 &grPaint)) { 607 &grPaint)) {
608 return; 608 return;
609 } 609 }
610 610
611 if (NULL == paint.getMaskFilter() && NULL == paint.getPathEffect()) { 611 if (nullptr == paint.getMaskFilter() && nullptr == paint.getPathEffect() ) {
612 fDrawContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatri x, outer, inner); 612 fDrawContext->drawDRRect(fRenderTarget, fClip, grPaint, *draw.fMatri x, outer, inner);
613 return; 613 return;
614 } 614 }
615 } 615 }
616 616
617 SkPath path; 617 SkPath path;
618 path.setIsVolatile(true); 618 path.setIsVolatile(true);
619 path.addRRect(outer); 619 path.addRRect(outer);
620 path.addRRect(inner); 620 path.addRRect(inner);
621 path.setFillType(SkPath::kEvenOdd_FillType); 621 path.setFillType(SkPath::kEvenOdd_FillType);
622 622
623 this->drawPath(draw, path, paint, NULL, true); 623 this->drawPath(draw, path, paint, nullptr, true);
624 } 624 }
625 625
626 626
627 ///////////////////////////////////////////////////////////////////////////// 627 /////////////////////////////////////////////////////////////////////////////
628 628
629 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, 629 void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval,
630 const SkPaint& paint) { 630 const SkPaint& paint) {
631 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext); 631 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawOval", fContext);
632 CHECK_FOR_ANNOTATION(paint); 632 CHECK_FOR_ANNOTATION(paint);
633 CHECK_SHOULD_DRAW(draw); 633 CHECK_SHOULD_DRAW(draw);
634 634
635 GrStrokeInfo strokeInfo(paint); 635 GrStrokeInfo strokeInfo(paint);
636 636
637 bool usePath = false; 637 bool usePath = false;
638 // some basic reasons we might need to call drawPath... 638 // some basic reasons we might need to call drawPath...
639 if (paint.getMaskFilter()) { 639 if (paint.getMaskFilter()) {
640 usePath = true; 640 usePath = true;
641 } else { 641 } else {
642 const SkPathEffect* pe = paint.getPathEffect(); 642 const SkPathEffect* pe = paint.getPathEffect();
643 if (pe && !strokeInfo.isDashed()) { 643 if (pe && !strokeInfo.isDashed()) {
644 usePath = true; 644 usePath = true;
645 } 645 }
646 } 646 }
647 647
648 if (usePath) { 648 if (usePath) {
649 SkPath path; 649 SkPath path;
650 path.setIsVolatile(true); 650 path.setIsVolatile(true);
651 path.addOval(oval); 651 path.addOval(oval);
652 this->drawPath(draw, path, paint, NULL, true); 652 this->drawPath(draw, path, paint, nullptr, true);
653 return; 653 return;
654 } 654 }
655 655
656 GrPaint grPaint; 656 GrPaint grPaint;
657 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) { 657 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fMatrix, t rue, &grPaint)) {
658 return; 658 return;
659 } 659 }
660 660
661 fDrawContext->drawOval(fRenderTarget, fClip, grPaint, *draw.fMatrix, oval, s trokeInfo); 661 fDrawContext->drawOval(fRenderTarget, fClip, grPaint, *draw.fMatrix, oval, s trokeInfo);
662 } 662 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 } 712 }
713 713
714 // Given a bitmap, an optional src rect, and a context with a clip and matrix de termine what 714 // Given a bitmap, an optional src rect, and a context with a clip and matrix de termine what
715 // pixels from the bitmap are necessary. 715 // pixels from the bitmap are necessary.
716 static void determine_clipped_src_rect(const GrRenderTarget* rt, 716 static void determine_clipped_src_rect(const GrRenderTarget* rt,
717 const GrClip& clip, 717 const GrClip& clip,
718 const SkMatrix& viewMatrix, 718 const SkMatrix& viewMatrix,
719 const SkBitmap& bitmap, 719 const SkBitmap& bitmap,
720 const SkRect* srcRectPtr, 720 const SkRect* srcRectPtr,
721 SkIRect* clippedSrcIRect) { 721 SkIRect* clippedSrcIRect) {
722 clip.getConservativeBounds(rt, clippedSrcIRect, NULL); 722 clip.getConservativeBounds(rt, clippedSrcIRect, nullptr);
723 SkMatrix inv; 723 SkMatrix inv;
724 if (!viewMatrix.invert(&inv)) { 724 if (!viewMatrix.invert(&inv)) {
725 clippedSrcIRect->setEmpty(); 725 clippedSrcIRect->setEmpty();
726 return; 726 return;
727 } 727 }
728 SkRect clippedSrcRect = SkRect::Make(*clippedSrcIRect); 728 SkRect clippedSrcRect = SkRect::Make(*clippedSrcIRect);
729 inv.mapRect(&clippedSrcRect); 729 inv.mapRect(&clippedSrcRect);
730 if (srcRectPtr) { 730 if (srcRectPtr) {
731 // we've setup src space 0,0 to map to the top left of the src rect. 731 // we've setup src space 0,0 to map to the top left of the src rect.
732 clippedSrcRect.offset(srcRectPtr->fLeft, srcRectPtr->fTop); 732 clippedSrcRect.offset(srcRectPtr->fLeft, srcRectPtr->fTop);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 773
774 // At this point we know we could do the draw by uploading the entire bitmap 774 // At this point we know we could do the draw by uploading the entire bitmap
775 // as a texture. However, if the texture would be large compared to the 775 // as a texture. However, if the texture would be large compared to the
776 // cache size and we don't require most of it for this draw then tile to 776 // cache size and we don't require most of it for this draw then tile to
777 // reduce the amount of upload and cache spill. 777 // reduce the amount of upload and cache spill.
778 778
779 // assumption here is that sw bitmap size is a good proxy for its size as 779 // assumption here is that sw bitmap size is a good proxy for its size as
780 // a texture 780 // a texture
781 size_t bmpSize = bitmap.getSize(); 781 size_t bmpSize = bitmap.getSize();
782 size_t cacheSize; 782 size_t cacheSize;
783 fContext->getResourceCacheLimits(NULL, &cacheSize); 783 fContext->getResourceCacheLimits(nullptr, &cacheSize);
784 if (bmpSize < cacheSize / 2) { 784 if (bmpSize < cacheSize / 2) {
785 return false; 785 return false;
786 } 786 }
787 787
788 // Figure out how much of the src we will need based on the src rect and cli pping. 788 // Figure out how much of the src we will need based on the src rect and cli pping.
789 determine_clipped_src_rect(fRenderTarget, fClip, viewMatrix, bitmap, srcRect Ptr, 789 determine_clipped_src_rect(fRenderTarget, fClip, viewMatrix, bitmap, srcRect Ptr,
790 clippedSrcRect); 790 clippedSrcRect);
791 *tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile. 791 *tileSize = kBmpSmallTileSize; // already know whole bitmap fits in one max sized tile.
792 size_t usedTileBytes = get_tile_count(*clippedSrcRect, kBmpSmallTileSize) * 792 size_t usedTileBytes = get_tile_count(*clippedSrcRect, kBmpSmallTileSize) *
793 kBmpSmallTileSize * kBmpSmallTileSize; 793 kBmpSmallTileSize * kBmpSmallTileSize;
794 794
795 return usedTileBytes < 2 * bmpSize; 795 return usedTileBytes < 2 * bmpSize;
796 } 796 }
797 797
798 void SkGpuDevice::drawBitmap(const SkDraw& origDraw, 798 void SkGpuDevice::drawBitmap(const SkDraw& origDraw,
799 const SkBitmap& bitmap, 799 const SkBitmap& bitmap,
800 const SkMatrix& m, 800 const SkMatrix& m,
801 const SkPaint& paint) { 801 const SkPaint& paint) {
802 SkMatrix concat; 802 SkMatrix concat;
803 SkTCopyOnFirstWrite<SkDraw> draw(origDraw); 803 SkTCopyOnFirstWrite<SkDraw> draw(origDraw);
804 if (!m.isIdentity()) { 804 if (!m.isIdentity()) {
805 concat.setConcat(*draw->fMatrix, m); 805 concat.setConcat(*draw->fMatrix, m);
806 draw.writable()->fMatrix = &concat; 806 draw.writable()->fMatrix = &concat;
807 } 807 }
808 this->drawBitmapCommon(*draw, bitmap, NULL, NULL, paint, SkCanvas::kStrict_S rcRectConstraint); 808 this->drawBitmapCommon(*draw, bitmap, nullptr, nullptr, paint, SkCanvas::kSt rict_SrcRectConstraint);
809 } 809 }
810 810
811 // This method outsets 'iRect' by 'outset' all around and then clamps its extent s to 811 // This method outsets 'iRect' by 'outset' all around and then clamps its extent s to
812 // 'clamp'. 'offset' is adjusted to remain positioned over the top-left corner 812 // 'clamp'. 'offset' is adjusted to remain positioned over the top-left corner
813 // of 'iRect' for all possible outsets/clamps. 813 // of 'iRect' for all possible outsets/clamps.
814 static inline void clamped_outset_with_offset(SkIRect* iRect, 814 static inline void clamped_outset_with_offset(SkIRect* iRect,
815 int outset, 815 int outset,
816 SkPoint* offset, 816 SkPoint* offset,
817 const SkIRect& clamp) { 817 const SkIRect& clamp) {
818 iRect->outset(outset, outset); 818 iRect->outset(outset, outset);
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 const SkRect* srcRectPtr, 1000 const SkRect* srcRectPtr,
1001 const SkSize* dstSizePtr, 1001 const SkSize* dstSizePtr,
1002 const SkPaint& paint, 1002 const SkPaint& paint,
1003 SkCanvas::SrcRectConstraint constraint) { 1003 SkCanvas::SrcRectConstraint constraint) {
1004 CHECK_SHOULD_DRAW(draw); 1004 CHECK_SHOULD_DRAW(draw);
1005 1005
1006 SkRect srcRect; 1006 SkRect srcRect;
1007 SkSize dstSize; 1007 SkSize dstSize;
1008 // If there is no src rect, or the src rect contains the entire bitmap then we're effectively 1008 // If there is no src rect, or the src rect contains the entire bitmap then we're effectively
1009 // in the (easier) bleed case, so update flags. 1009 // in the (easier) bleed case, so update flags.
1010 if (NULL == srcRectPtr) { 1010 if (nullptr == srcRectPtr) {
1011 SkScalar w = SkIntToScalar(bitmap.width()); 1011 SkScalar w = SkIntToScalar(bitmap.width());
1012 SkScalar h = SkIntToScalar(bitmap.height()); 1012 SkScalar h = SkIntToScalar(bitmap.height());
1013 dstSize.fWidth = w; 1013 dstSize.fWidth = w;
1014 dstSize.fHeight = h; 1014 dstSize.fHeight = h;
1015 srcRect.set(0, 0, w, h); 1015 srcRect.set(0, 0, w, h);
1016 } else { 1016 } else {
1017 SkASSERT(dstSizePtr); 1017 SkASSERT(dstSizePtr);
1018 srcRect = *srcRectPtr; 1018 srcRect = *srcRectPtr;
1019 dstSize = *dstSizePtr; 1019 dstSize = *dstSizePtr;
1020 } 1020 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1239 const GrTextureParams& params, 1239 const GrTextureParams& params,
1240 const SkPaint& paint, 1240 const SkPaint& paint,
1241 SkCanvas::SrcRectConstraint constraint, 1241 SkCanvas::SrcRectConstraint constraint,
1242 bool bicubic, 1242 bool bicubic,
1243 bool needsTextureDomain) { 1243 bool needsTextureDomain) {
1244 SkASSERT(bitmap.width() <= fContext->caps()->maxTextureSize() && 1244 SkASSERT(bitmap.width() <= fContext->caps()->maxTextureSize() &&
1245 bitmap.height() <= fContext->caps()->maxTextureSize()); 1245 bitmap.height() <= fContext->caps()->maxTextureSize());
1246 1246
1247 GrTexture* texture; 1247 GrTexture* texture;
1248 AutoBitmapTexture abt(fContext, bitmap, &params, &texture); 1248 AutoBitmapTexture abt(fContext, bitmap, &params, &texture);
1249 if (NULL == texture) { 1249 if (nullptr == texture) {
1250 return; 1250 return;
1251 } 1251 }
1252 1252
1253 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() }; 1253 SkRect dstRect = {0, 0, srcRect.width(), srcRect.height() };
1254 SkRect paintRect; 1254 SkRect paintRect;
1255 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width())); 1255 SkScalar wInv = SkScalarInvert(SkIntToScalar(texture->width()));
1256 SkScalar hInv = SkScalarInvert(SkIntToScalar(texture->height())); 1256 SkScalar hInv = SkScalarInvert(SkIntToScalar(texture->height()));
1257 paintRect.setLTRB(SkScalarMul(srcRect.fLeft, wInv), 1257 paintRect.setLTRB(SkScalarMul(srcRect.fLeft, wInv),
1258 SkScalarMul(srcRect.fTop, hInv), 1258 SkScalarMul(srcRect.fTop, hInv),
1259 SkScalarMul(srcRect.fRight, wInv), 1259 SkScalarMul(srcRect.fRight, wInv),
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 SkAutoLockPixels alp(bitmap, !bitmap.getTexture()); 1343 SkAutoLockPixels alp(bitmap, !bitmap.getTexture());
1344 if (!bitmap.getTexture() && !bitmap.readyToDraw()) { 1344 if (!bitmap.getTexture() && !bitmap.readyToDraw()) {
1345 return; 1345 return;
1346 } 1346 }
1347 1347
1348 int w = bitmap.width(); 1348 int w = bitmap.width();
1349 int h = bitmap.height(); 1349 int h = bitmap.height();
1350 1350
1351 GrTexture* texture; 1351 GrTexture* texture;
1352 // draw sprite uses the default texture params 1352 // draw sprite uses the default texture params
1353 AutoBitmapTexture abt(fContext, bitmap, NULL, &texture); 1353 AutoBitmapTexture abt(fContext, bitmap, nullptr, &texture);
1354 if (!texture) { 1354 if (!texture) {
1355 return; 1355 return;
1356 } 1356 }
1357 1357
1358 SkImageFilter* filter = paint.getImageFilter(); 1358 SkImageFilter* filter = paint.getImageFilter();
1359 // This bitmap will own the filtered result as a texture. 1359 // This bitmap will own the filtered result as a texture.
1360 SkBitmap filteredBitmap; 1360 SkBitmap filteredBitmap;
1361 1361
1362 if (filter) { 1362 if (filter) {
1363 SkIPoint offset = SkIPoint::Make(0, 0); 1363 SkIPoint offset = SkIPoint::Make(0, 0);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
1455 1455
1456 // TODO: If the source device covers the whole of this device, we could 1456 // TODO: If the source device covers the whole of this device, we could
1457 // omit fNeedsClear -related flushing. 1457 // omit fNeedsClear -related flushing.
1458 // TODO: if source needs clear, we could maybe omit the draw fully. 1458 // TODO: if source needs clear, we could maybe omit the draw fully.
1459 1459
1460 // drawDevice is defined to be in device coords. 1460 // drawDevice is defined to be in device coords.
1461 CHECK_SHOULD_DRAW(draw); 1461 CHECK_SHOULD_DRAW(draw);
1462 1462
1463 GrRenderTarget* devRT = dev->accessRenderTarget(); 1463 GrRenderTarget* devRT = dev->accessRenderTarget();
1464 GrTexture* devTex; 1464 GrTexture* devTex;
1465 if (NULL == (devTex = devRT->asTexture())) { 1465 if (nullptr == (devTex = devRT->asTexture())) {
1466 return; 1466 return;
1467 } 1467 }
1468 1468
1469 const SkImageInfo ii = dev->imageInfo(); 1469 const SkImageInfo ii = dev->imageInfo();
1470 int w = ii.width(); 1470 int w = ii.width();
1471 int h = ii.height(); 1471 int h = ii.height();
1472 1472
1473 SkImageFilter* filter = paint.getImageFilter(); 1473 SkImageFilter* filter = paint.getImageFilter();
1474 // This bitmap will own the filtered result as a texture. 1474 // This bitmap will own the filtered result as a texture.
1475 SkBitmap filteredBitmap; 1475 SkBitmap filteredBitmap;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1530 } 1530 }
1531 1531
1532 SkAutoLockPixels alp(src, !src.getTexture()); 1532 SkAutoLockPixels alp(src, !src.getTexture());
1533 if (!src.getTexture() && !src.readyToDraw()) { 1533 if (!src.getTexture() && !src.readyToDraw()) {
1534 return false; 1534 return false;
1535 } 1535 }
1536 1536
1537 GrTexture* texture; 1537 GrTexture* texture;
1538 // We assume here that the filter will not attempt to tile the src. Otherwis e, this cache lookup 1538 // We assume here that the filter will not attempt to tile the src. Otherwis e, this cache lookup
1539 // must be pushed upstack. 1539 // must be pushed upstack.
1540 AutoBitmapTexture abt(fContext, src, NULL, &texture); 1540 AutoBitmapTexture abt(fContext, src, nullptr, &texture);
1541 if (!texture) { 1541 if (!texture) {
1542 return false; 1542 return false;
1543 } 1543 }
1544 1544
1545 return this->filterTexture(fContext, texture, src.width(), src.height(), 1545 return this->filterTexture(fContext, texture, src.width(), src.height(),
1546 filter, ctx, result, offset); 1546 filter, ctx, result, offset);
1547 } 1547 }
1548 1548
1549 static bool wrap_as_bm(const SkImage* image, SkBitmap* bm) { 1549 static bool wrap_as_bm(const SkImage* image, SkBitmap* bm) {
1550 GrTexture* tex = as_IB(image)->getTexture(); 1550 GrTexture* tex = as_IB(image)->getTexture();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode, 1585 void SkGpuDevice::drawVertices(const SkDraw& draw, SkCanvas::VertexMode vmode,
1586 int vertexCount, const SkPoint vertices[], 1586 int vertexCount, const SkPoint vertices[],
1587 const SkPoint texs[], const SkColor colors[], 1587 const SkPoint texs[], const SkColor colors[],
1588 SkXfermode* xmode, 1588 SkXfermode* xmode,
1589 const uint16_t indices[], int indexCount, 1589 const uint16_t indices[], int indexCount,
1590 const SkPaint& paint) { 1590 const SkPaint& paint) {
1591 CHECK_SHOULD_DRAW(draw); 1591 CHECK_SHOULD_DRAW(draw);
1592 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawVertices", fContext); 1592 GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice::drawVertices", fContext);
1593 1593
1594 const uint16_t* outIndices; 1594 const uint16_t* outIndices;
1595 SkAutoTDeleteArray<uint16_t> outAlloc(NULL); 1595 SkAutoTDeleteArray<uint16_t> outAlloc(nullptr);
1596 GrPrimitiveType primType; 1596 GrPrimitiveType primType;
1597 GrPaint grPaint; 1597 GrPaint grPaint;
1598 1598
1599 // If both textures and vertex-colors are NULL, strokes hairlines with the p aint's color. 1599 // If both textures and vertex-colors are nullptr, strokes hairlines with th e paint's color.
1600 if ((NULL == texs || NULL == paint.getShader()) && NULL == colors) { 1600 if ((nullptr == texs || nullptr == paint.getShader()) && nullptr == colors) {
1601 1601
1602 texs = NULL; 1602 texs = nullptr;
1603 1603
1604 SkPaint copy(paint); 1604 SkPaint copy(paint);
1605 copy.setStyle(SkPaint::kStroke_Style); 1605 copy.setStyle(SkPaint::kStroke_Style);
1606 copy.setStrokeWidth(0); 1606 copy.setStrokeWidth(0);
1607 1607
1608 // we ignore the shader if texs is null. 1608 // we ignore the shader if texs is null.
1609 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, copy, 1609 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, copy,
1610 SkColor2GrColor(copy.getColor()), NULL == c olors, &grPaint)) { 1610 SkColor2GrColor(copy.getColor()), nullptr = = colors, &grPaint)) {
1611 return; 1611 return;
1612 } 1612 }
1613 1613
1614 primType = kLines_GrPrimitiveType; 1614 primType = kLines_GrPrimitiveType;
1615 int triangleCount = 0; 1615 int triangleCount = 0;
1616 int n = (NULL == indices) ? vertexCount : indexCount; 1616 int n = (nullptr == indices) ? vertexCount : indexCount;
1617 switch (vmode) { 1617 switch (vmode) {
1618 case SkCanvas::kTriangles_VertexMode: 1618 case SkCanvas::kTriangles_VertexMode:
1619 triangleCount = n / 3; 1619 triangleCount = n / 3;
1620 break; 1620 break;
1621 case SkCanvas::kTriangleStrip_VertexMode: 1621 case SkCanvas::kTriangleStrip_VertexMode:
1622 case SkCanvas::kTriangleFan_VertexMode: 1622 case SkCanvas::kTriangleFan_VertexMode:
1623 triangleCount = n - 2; 1623 triangleCount = n - 2;
1624 break; 1624 break;
1625 } 1625 }
1626 1626
(...skipping 13 matching lines...) Expand all
1640 auxIndices[i + 2] = state.f1; 1640 auxIndices[i + 2] = state.f1;
1641 auxIndices[i + 3] = state.f2; 1641 auxIndices[i + 3] = state.f2;
1642 auxIndices[i + 4] = state.f2; 1642 auxIndices[i + 4] = state.f2;
1643 auxIndices[i + 5] = state.f0; 1643 auxIndices[i + 5] = state.f0;
1644 i += 6; 1644 i += 6;
1645 } 1645 }
1646 } else { 1646 } else {
1647 outIndices = indices; 1647 outIndices = indices;
1648 primType = gVertexMode2PrimitiveType[vmode]; 1648 primType = gVertexMode2PrimitiveType[vmode];
1649 1649
1650 if (NULL == texs || NULL == paint.getShader()) { 1650 if (nullptr == texs || nullptr == paint.getShader()) {
1651 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint, 1651 if (!SkPaint2GrPaintNoShader(this->context(), fRenderTarget, paint,
1652 SkColor2GrColor(paint.getColor()), 1652 SkColor2GrColor(paint.getColor()),
1653 NULL == colors, &grPaint)) { 1653 nullptr == colors, &grPaint)) {
1654 return; 1654 return;
1655 } 1655 }
1656 } else { 1656 } else {
1657 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fM atrix, 1657 if (!SkPaint2GrPaint(this->context(), fRenderTarget, paint, *draw.fM atrix,
1658 NULL == colors, &grPaint)) { 1658 nullptr == colors, &grPaint)) {
1659 return; 1659 return;
1660 } 1660 }
1661 } 1661 }
1662 } 1662 }
1663 1663
1664 #if 0 1664 #if 0
1665 if (xmode && texs && colors) { 1665 if (xmode && texs && colors) {
1666 if (!SkXfermode::IsMode(xmode, SkXfermode::kModulate_Mode)) { 1666 if (!SkXfermode::IsMode(xmode, SkXfermode::kModulate_Mode)) {
1667 SkDebugf("Unsupported vertex-color/texture xfer mode.\n"); 1667 SkDebugf("Unsupported vertex-color/texture xfer mode.\n");
1668 return; 1668 return;
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 } 1815 }
1816 1816
1817 if (texture) { 1817 if (texture) {
1818 SkSurfaceProps props(this->surfaceProps().flags(), cinfo.fPixelGeometry) ; 1818 SkSurfaceProps props(this->surfaceProps().flags(), cinfo.fPixelGeometry) ;
1819 return SkGpuDevice::Create( 1819 return SkGpuDevice::Create(
1820 texture->asRenderTarget(), cinfo.fInfo.width(), cinfo.fInfo.height() , &props, init); 1820 texture->asRenderTarget(), cinfo.fInfo.width(), cinfo.fInfo.height() , &props, init);
1821 } else { 1821 } else {
1822 SkErrorInternals::SetError( kInternalError_SkError, 1822 SkErrorInternals::SetError( kInternalError_SkError,
1823 "---- failed to create gpu device texture [% d %d]\n", 1823 "---- failed to create gpu device texture [% d %d]\n",
1824 cinfo.fInfo.width(), cinfo.fInfo.height()); 1824 cinfo.fInfo.width(), cinfo.fInfo.height());
1825 return NULL; 1825 return nullptr;
1826 } 1826 }
1827 } 1827 }
1828 1828
1829 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps & props) { 1829 SkSurface* SkGpuDevice::newSurface(const SkImageInfo& info, const SkSurfaceProps & props) {
1830 // TODO: Change the signature of newSurface to take a budgeted parameter. 1830 // TODO: Change the signature of newSurface to take a budgeted parameter.
1831 static const SkSurface::Budgeted kBudgeted = SkSurface::kNo_Budgeted; 1831 static const SkSurface::Budgeted kBudgeted = SkSurface::kNo_Budgeted;
1832 return SkSurface::NewRenderTarget(fContext, kBudgeted, info, fRenderTarget-> desc().fSampleCnt, 1832 return SkSurface::NewRenderTarget(fContext, kBudgeted, info, fRenderTarget-> desc().fSampleCnt,
1833 &props); 1833 &props);
1834 } 1834 }
1835 1835
1836 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * mainPicture, 1836 bool SkGpuDevice::EXPERIMENTAL_drawPicture(SkCanvas* mainCanvas, const SkPicture * mainPicture,
1837 const SkMatrix* matrix, const SkPaint * paint) { 1837 const SkMatrix* matrix, const SkPaint * paint) {
1838 #ifndef SK_IGNORE_GPU_LAYER_HOISTING 1838 #ifndef SK_IGNORE_GPU_LAYER_HOISTING
1839 // todo: should handle this natively 1839 // todo: should handle this natively
1840 if (paint) { 1840 if (paint) {
1841 return false; 1841 return false;
1842 } 1842 }
1843 1843
1844 const SkBigPicture::AccelData* data = NULL; 1844 const SkBigPicture::AccelData* data = nullptr;
1845 if (const SkBigPicture* bp = mainPicture->asSkBigPicture()) { 1845 if (const SkBigPicture* bp = mainPicture->asSkBigPicture()) {
1846 data = bp->accelData(); 1846 data = bp->accelData();
1847 } 1847 }
1848 if (!data) { 1848 if (!data) {
1849 return false; 1849 return false;
1850 } 1850 }
1851 1851
1852 const SkLayerInfo *gpuData = static_cast<const SkLayerInfo*>(data); 1852 const SkLayerInfo *gpuData = static_cast<const SkLayerInfo*>(data);
1853 if (0 == gpuData->numBlocks()) { 1853 if (0 == gpuData->numBlocks()) {
1854 return false; 1854 return false;
(...skipping 25 matching lines...) Expand all
1880 GrLayerHoister::FindLayersToHoist(fContext, mainPicture, 1880 GrLayerHoister::FindLayersToHoist(fContext, mainPicture,
1881 initialMatrix, 1881 initialMatrix,
1882 clipBounds, 1882 clipBounds,
1883 &needRendering, &recycled, 1883 &needRendering, &recycled,
1884 fRenderTarget->numColorSamples()); 1884 fRenderTarget->numColorSamples());
1885 1885
1886 GrLayerHoister::DrawLayers(fContext, needRendering); 1886 GrLayerHoister::DrawLayers(fContext, needRendering);
1887 1887
1888 // Render the entire picture using new layers 1888 // Render the entire picture using new layers
1889 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(), 1889 GrRecordReplaceDraw(mainPicture, mainCanvas, fContext->getLayerCache(),
1890 initialMatrix, NULL); 1890 initialMatrix, nullptr);
1891 1891
1892 GrLayerHoister::UnlockLayers(fContext, needRendering); 1892 GrLayerHoister::UnlockLayers(fContext, needRendering);
1893 GrLayerHoister::UnlockLayers(fContext, recycled); 1893 GrLayerHoister::UnlockLayers(fContext, recycled);
1894 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering); 1894 GrLayerHoister::UnlockLayers(fContext, atlasedNeedRendering);
1895 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled); 1895 GrLayerHoister::UnlockLayers(fContext, atlasedRecycled);
1896 1896
1897 return true; 1897 return true;
1898 #else 1898 #else
1899 return false; 1899 return false;
1900 #endif 1900 #endif
1901 } 1901 }
1902 1902
1903 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() { 1903 SkImageFilter::Cache* SkGpuDevice::getImageFilterCache() {
1904 // We always return a transient cache, so it is freed after each 1904 // We always return a transient cache, so it is freed after each
1905 // filter traversal. 1905 // filter traversal.
1906 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize); 1906 return SkImageFilter::Cache::Create(kDefaultImageFilterCacheSize);
1907 } 1907 }
1908 1908
1909 #endif 1909 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698