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

Side by Side Diff: src/utils/SkDeferredCanvas.cpp

Issue 1204433002: Begin kLegacyFontHost_InitType cleanup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add dox Created 5 years, 6 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/utils/SkCanvasStateUtils.cpp ('k') | tests/DeferredCanvasTest.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkDeferredCanvas.h" 9 #include "SkDeferredCanvas.h"
10 10
11 #include "SkBitmapDevice.h"
12 #include "SkChunkAlloc.h" 11 #include "SkChunkAlloc.h"
13 #include "SkColorFilter.h" 12 #include "SkColorFilter.h"
13 #include "SkDevice.h"
14 #include "SkDrawFilter.h" 14 #include "SkDrawFilter.h"
15 #include "SkGPipe.h" 15 #include "SkGPipe.h"
16 #include "SkImage_Base.h" 16 #include "SkImage_Base.h"
17 #include "SkPaint.h" 17 #include "SkPaint.h"
18 #include "SkPaintPriv.h" 18 #include "SkPaintPriv.h"
19 #include "SkRRect.h" 19 #include "SkRRect.h"
20 #include "SkShader.h" 20 #include "SkShader.h"
21 #include "SkSurface.h" 21 #include "SkSurface.h"
22 22
23 enum { 23 enum {
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 SkGPipeWriter fPipeWriter; 276 SkGPipeWriter fPipeWriter;
277 SkCanvas* fImmediateCanvas; 277 SkCanvas* fImmediateCanvas;
278 SkCanvas* fRecordingCanvas; 278 SkCanvas* fRecordingCanvas;
279 SkSurface* fSurface; 279 SkSurface* fSurface;
280 SkDeferredCanvas::NotificationClient* fNotificationClient; 280 SkDeferredCanvas::NotificationClient* fNotificationClient;
281 bool fFreshFrame; 281 bool fFreshFrame;
282 bool fCanDiscardCanvasContents; 282 bool fCanDiscardCanvasContents;
283 bool fIsDrawingToLayer; 283 bool fIsDrawingToLayer;
284 size_t fMaxRecordingStorageBytes; 284 size_t fMaxRecordingStorageBytes;
285 size_t fPreviousStorageAllocated; 285 size_t fPreviousStorageAllocated;
286
287 typedef SkBaseDevice INHERITED;
286 }; 288 };
287 289
288 SkDeferredDevice::SkDeferredDevice(SkSurface* surface) { 290 SkDeferredDevice::SkDeferredDevice(SkSurface* surface)
291 : INHERITED(surface->props()) {
289 fMaxRecordingStorageBytes = kDefaultMaxRecordingStorageBytes; 292 fMaxRecordingStorageBytes = kDefaultMaxRecordingStorageBytes;
290 fNotificationClient = NULL; 293 fNotificationClient = NULL;
291 fImmediateCanvas = NULL; 294 fImmediateCanvas = NULL;
292 fSurface = NULL; 295 fSurface = NULL;
293 this->setSurface(surface); 296 this->setSurface(surface);
294 this->init(); 297 this->init();
295 } 298 }
296 299
297 void SkDeferredDevice::setSurface(SkSurface* surface) { 300 void SkDeferredDevice::setSurface(SkSurface* surface) {
298 SkRefCnt_SafeAssign(fImmediateCanvas, surface->getCanvas()); 301 SkRefCnt_SafeAssign(fImmediateCanvas, surface->getCanvas());
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 fCanvas = &canvas; 533 fCanvas = &canvas;
531 } else { 534 } else {
532 fCanvas = NULL; 535 fCanvas = NULL;
533 } 536 }
534 } 537 }
535 538
536 SkDeferredCanvas* fCanvas; 539 SkDeferredCanvas* fCanvas;
537 }; 540 };
538 541
539 SkDeferredCanvas* SkDeferredCanvas::Create(SkSurface* surface) { 542 SkDeferredCanvas* SkDeferredCanvas::Create(SkSurface* surface) {
543 if (!surface) {
544 return NULL;
545 }
546
540 SkAutoTUnref<SkDeferredDevice> deferredDevice(SkNEW_ARGS(SkDeferredDevice, ( surface))); 547 SkAutoTUnref<SkDeferredDevice> deferredDevice(SkNEW_ARGS(SkDeferredDevice, ( surface)));
541 return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice)); 548 return SkNEW_ARGS(SkDeferredCanvas, (deferredDevice));
542 } 549 }
543 550
544 SkDeferredCanvas::SkDeferredCanvas(SkDeferredDevice* device) : SkCanvas (device) { 551 SkDeferredCanvas::SkDeferredCanvas(SkDeferredDevice* device) : SkCanvas (device) {
545 this->init(); 552 this->init();
546 } 553 }
547 554
548 void SkDeferredCanvas::init() { 555 void SkDeferredCanvas::init() {
549 fBitmapSizeThreshold = kDeferredCanvasBitmapSizeThreshold; 556 fBitmapSizeThreshold = kDeferredCanvasBitmapSizeThreshold;
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) { 992 SkDrawFilter* SkDeferredCanvas::setDrawFilter(SkDrawFilter* filter) {
986 this->drawingCanvas()->setDrawFilter(filter); 993 this->drawingCanvas()->setDrawFilter(filter);
987 this->INHERITED::setDrawFilter(filter); 994 this->INHERITED::setDrawFilter(filter);
988 this->recordedDrawCommand(); 995 this->recordedDrawCommand();
989 return filter; 996 return filter;
990 } 997 }
991 998
992 SkCanvas* SkDeferredCanvas::canvasForDrawIter() { 999 SkCanvas* SkDeferredCanvas::canvasForDrawIter() {
993 return this->drawingCanvas(); 1000 return this->drawingCanvas();
994 } 1001 }
OLDNEW
« no previous file with comments | « src/utils/SkCanvasStateUtils.cpp ('k') | tests/DeferredCanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698