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

Side by Side Diff: src/core/SkCanvasDrawable.cpp

Issue 727363003: wip for drawables (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make the pictures in the array also const (the array already was const) Created 6 years, 1 month 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/core/SkCanvasDrawable.h ('k') | src/core/SkPicture.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 2014 Google Inc. 2 * Copyright 2014 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkCanvasDrawable.h" 9 #include "SkCanvasDrawable.h"
10 #include "SkThread.h" 10 #include "SkThread.h"
(...skipping 10 matching lines...) Expand all
21 return genID; 21 return genID;
22 } 22 }
23 23
24 SkCanvasDrawable::SkCanvasDrawable() : fGenerationID(0) {} 24 SkCanvasDrawable::SkCanvasDrawable() : fGenerationID(0) {}
25 25
26 void SkCanvasDrawable::draw(SkCanvas* canvas) { 26 void SkCanvasDrawable::draw(SkCanvas* canvas) {
27 SkAutoCanvasRestore acr(canvas, true); 27 SkAutoCanvasRestore acr(canvas, true);
28 this->onDraw(canvas); 28 this->onDraw(canvas);
29 } 29 }
30 30
31 SkPicture* SkCanvasDrawable::newPictureSnapshot(SkBBHFactory* bbhFactory, uint32 _t recordFlags) {
32 return this->onNewPictureSnapshot(bbhFactory, recordFlags);
33 }
34
31 uint32_t SkCanvasDrawable::getGenerationID() { 35 uint32_t SkCanvasDrawable::getGenerationID() {
32 if (0 == fGenerationID) { 36 if (0 == fGenerationID) {
33 fGenerationID = next_generation_id(); 37 fGenerationID = next_generation_id();
34 } 38 }
35 return fGenerationID; 39 return fGenerationID;
36 } 40 }
37 41
38 bool SkCanvasDrawable::getBounds(SkRect* boundsPtr) { 42 SkRect SkCanvasDrawable::getBounds() {
39 SkRect bounds; 43 return this->onGetBounds();
40 if (!boundsPtr) {
41 boundsPtr = &bounds;
42 }
43 return this->onGetBounds(boundsPtr);
44 } 44 }
45 45
46 void SkCanvasDrawable::notifyDrawingChanged() { 46 void SkCanvasDrawable::notifyDrawingChanged() {
47 fGenerationID = 0; 47 fGenerationID = 0;
48 } 48 }
49 49
50 //////////////////////////////////////////////////////////////////////////////// /////////
50 51
52 #include "SkPictureRecorder.h"
53
54 SkPicture* SkCanvasDrawable::onNewPictureSnapshot(SkBBHFactory* bbhFactory, uint 32_t recordFlags) {
55 const SkRect bounds = this->getBounds();
56 SkPictureRecorder recorder;
57 this->draw(recorder.beginRecording(bounds.width(), bounds.height(), bbhFacto ry, recordFlags));
58 return recorder.endRecording();
59 }
OLDNEW
« no previous file with comments | « src/core/SkCanvasDrawable.h ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698