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

Side by Side Diff: src/effects/SkPictureImageFilter.cpp

Issue 138063005: Serialization of SkPictureImageFilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 11 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
« src/core/SkPicture.cpp ('K') | « src/core/SkPicturePlayback.cpp ('k') | no next file » | 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 2013 The Android Open Source Project 2 * Copyright 2013 The Android Open Source Project
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 "SkPictureImageFilter.h" 8 #include "SkPictureImageFilter.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 15 matching lines...) Expand all
26 SkSafeRef(fPicture); 26 SkSafeRef(fPicture);
27 } 27 }
28 28
29 SkPictureImageFilter::~SkPictureImageFilter() { 29 SkPictureImageFilter::~SkPictureImageFilter() {
30 SkSafeUnref(fPicture); 30 SkSafeUnref(fPicture);
31 } 31 }
32 32
33 SkPictureImageFilter::SkPictureImageFilter(SkFlattenableReadBuffer& buffer) 33 SkPictureImageFilter::SkPictureImageFilter(SkFlattenableReadBuffer& buffer)
34 : INHERITED(0, buffer), 34 : INHERITED(0, buffer),
35 fPicture(NULL) { 35 fPicture(NULL) {
36 // FIXME: unflatten picture here. 36 if (buffer.readBool()) {
37 fPicture = SkPicture::CreateFromBuffer(buffer);
38 }
37 buffer.readRect(&fRect); 39 buffer.readRect(&fRect);
38 } 40 }
39 41
40 void SkPictureImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const { 42 void SkPictureImageFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
41 this->INHERITED::flatten(buffer); 43 this->INHERITED::flatten(buffer);
42 // FIXME: flatten picture here. 44 bool hasPicture = (fPicture != NULL);
45 buffer.writeBool(hasPicture);
46 if (hasPicture) {
47 fPicture->flatten(buffer);
48 }
43 buffer.writeRect(fRect); 49 buffer.writeRect(fRect);
44 } 50 }
45 51
46 bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Sk Matrix& matrix, 52 bool SkPictureImageFilter::onFilterImage(Proxy* proxy, const SkBitmap&, const Sk Matrix& matrix,
47 SkBitmap* result, SkIPoint* offset) { 53 SkBitmap* result, SkIPoint* offset) {
48 if (!fPicture) { 54 if (!fPicture) {
49 offset->fX = offset->fY = 0; 55 offset->fX = offset->fY = 0;
50 return true; 56 return true;
51 } 57 }
52 58
(...skipping 17 matching lines...) Expand all
70 76
71 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop)); 77 canvas.translate(-SkIntToScalar(bounds.fLeft), -SkIntToScalar(bounds.fTop));
72 canvas.concat(matrix); 78 canvas.concat(matrix);
73 canvas.drawPicture(*fPicture); 79 canvas.drawPicture(*fPicture);
74 80
75 *result = device.get()->accessBitmap(false); 81 *result = device.get()->accessBitmap(false);
76 offset->fX = bounds.fLeft; 82 offset->fX = bounds.fLeft;
77 offset->fY = bounds.fTop; 83 offset->fY = bounds.fTop;
78 return true; 84 return true;
79 } 85 }
OLDNEW
« src/core/SkPicture.cpp ('K') | « src/core/SkPicturePlayback.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698