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

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

Issue 390023002: Make SkPictureShader and SkPictureImageFilter use const SkPictures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 5 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/core/SkPictureShader.h ('k') | src/effects/SkPictureImageFilter.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 "SkPictureShader.h" 8 #include "SkPictureShader.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
11 #include "SkBitmapProcShader.h" 11 #include "SkBitmapProcShader.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkMatrixUtils.h" 13 #include "SkMatrixUtils.h"
14 #include "SkPicture.h" 14 #include "SkPicture.h"
15 #include "SkReadBuffer.h" 15 #include "SkReadBuffer.h"
16 16
17 #if SK_SUPPORT_GPU 17 #if SK_SUPPORT_GPU
18 #include "GrContext.h" 18 #include "GrContext.h"
19 #endif 19 #endif
20 20
21 SkPictureShader::SkPictureShader(SkPicture* picture, TileMode tmx, TileMode tmy, 21 SkPictureShader::SkPictureShader(const SkPicture* picture, TileMode tmx, TileMod e tmy,
22 const SkMatrix* localMatrix) 22 const SkMatrix* localMatrix)
23 : INHERITED(localMatrix) 23 : INHERITED(localMatrix)
24 , fPicture(SkRef(picture)) 24 , fPicture(SkRef(picture))
25 , fTmx(tmx) 25 , fTmx(tmx)
26 , fTmy(tmy) { } 26 , fTmy(tmy) { }
27 27
28 SkPictureShader::SkPictureShader(SkReadBuffer& buffer) 28 SkPictureShader::SkPictureShader(SkReadBuffer& buffer)
29 : INHERITED(buffer) { 29 : INHERITED(buffer) {
30 fTmx = static_cast<SkShader::TileMode>(buffer.read32()); 30 fTmx = static_cast<SkShader::TileMode>(buffer.read32());
31 fTmy = static_cast<SkShader::TileMode>(buffer.read32()); 31 fTmy = static_cast<SkShader::TileMode>(buffer.read32());
32 fPicture = SkPicture::CreateFromBuffer(buffer); 32 fPicture = SkPicture::CreateFromBuffer(buffer);
33 } 33 }
34 34
35 SkPictureShader::~SkPictureShader() { 35 SkPictureShader::~SkPictureShader() {
36 fPicture->unref(); 36 fPicture->unref();
37 } 37 }
38 38
39 SkPictureShader* SkPictureShader::Create(SkPicture* picture, TileMode tmx, TileM ode tmy, 39 SkPictureShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMode tmy,
40 const SkMatrix* localMatrix) { 40 const SkMatrix* localMatrix) {
41 if (!picture || 0 == picture->width() || 0 == picture->height()) { 41 if (!picture || 0 == picture->width() || 0 == picture->height()) {
42 return NULL; 42 return NULL;
43 } 43 }
44 return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix)); 44 return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix));
45 } 45 }
46 46
47 void SkPictureShader::flatten(SkWriteBuffer& buffer) const { 47 void SkPictureShader::flatten(SkWriteBuffer& buffer) const {
48 this->INHERITED::flatten(buffer); 48 this->INHERITED::flatten(buffer);
49 49
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 return bitmapShader->asNewEffect(context, paint, NULL, paintColor, effect); 195 return bitmapShader->asNewEffect(context, paint, NULL, paintColor, effect);
196 } 196 }
197 #else 197 #else
198 bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint, 198 bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint,
199 const SkMatrix* localMatrix, GrColor* paintCol or, 199 const SkMatrix* localMatrix, GrColor* paintCol or,
200 GrEffect** effect) const { 200 GrEffect** effect) const {
201 SkDEBUGFAIL("Should not call in GPU-less build"); 201 SkDEBUGFAIL("Should not call in GPU-less build");
202 return false; 202 return false;
203 } 203 }
204 #endif 204 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureShader.h ('k') | src/effects/SkPictureImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698