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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 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/core/SkPictureRecorder.cpp ('k') | src/core/SkPictureStateTree.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(const SkPicture* picture, TileMode tmx, TileMod e tmy, 21 SkPictureShader::SkPictureShader(const SkPicture* picture, TileMode tmx, TileMod e tmy,
22 const SkMatrix* localMatrix, const SkRect* tile ) 22 const SkMatrix* localMatrix, const SkRect* tile )
23 : INHERITED(localMatrix) 23 : INHERITED(localMatrix)
24 , fPicture(SkRef(picture)) 24 , fPicture(SkRef(picture))
25 , fTile(NULL != tile ? *tile : picture->cullRect()) 25 , fTile(tile ? *tile : picture->cullRect())
26 , fTmx(tmx) 26 , fTmx(tmx)
27 , fTmy(tmy) { 27 , fTmy(tmy) {
28 } 28 }
29 29
30 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 30 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
31 SkPictureShader::SkPictureShader(SkReadBuffer& buffer) : INHERITED(buffer) { 31 SkPictureShader::SkPictureShader(SkReadBuffer& buffer) : INHERITED(buffer) {
32 fTmx = static_cast<SkShader::TileMode>(buffer.read32()); 32 fTmx = static_cast<SkShader::TileMode>(buffer.read32());
33 fTmy = static_cast<SkShader::TileMode>(buffer.read32()); 33 fTmy = static_cast<SkShader::TileMode>(buffer.read32());
34 buffer.readRect(&fTile); 34 buffer.readRect(&fTile);
35 fPicture = SkPicture::CreateFromBuffer(buffer); 35 fPicture = SkPicture::CreateFromBuffer(buffer);
36 } 36 }
37 #endif 37 #endif
38 38
39 SkPictureShader::~SkPictureShader() { 39 SkPictureShader::~SkPictureShader() {
40 fPicture->unref(); 40 fPicture->unref();
41 } 41 }
42 42
43 SkPictureShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMode tmy, 43 SkPictureShader* SkPictureShader::Create(const SkPicture* picture, TileMode tmx, TileMode tmy,
44 const SkMatrix* localMatrix, const SkRe ct* tile) { 44 const SkMatrix* localMatrix, const SkRe ct* tile) {
45 if (!picture || picture->cullRect().isEmpty() || (NULL != tile && tile->isEm pty())) { 45 if (!picture || picture->cullRect().isEmpty() || (tile && tile->isEmpty())) {
46 return NULL; 46 return NULL;
47 } 47 }
48 return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile)); 48 return SkNEW_ARGS(SkPictureShader, (picture, tmx, tmy, localMatrix, tile));
49 } 49 }
50 50
51 SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) { 51 SkFlattenable* SkPictureShader::CreateProc(SkReadBuffer& buffer) {
52 SkMatrix lm; 52 SkMatrix lm;
53 buffer.readMatrix(&lm); 53 buffer.readMatrix(&lm);
54 TileMode mx = (TileMode)buffer.read32(); 54 TileMode mx = (TileMode)buffer.read32();
55 TileMode my = (TileMode)buffer.read32(); 55 TileMode my = (TileMode)buffer.read32();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return bitmapShader->asNewEffect(context, paint, NULL, paintColor, effect); 222 return bitmapShader->asNewEffect(context, paint, NULL, paintColor, effect);
223 } 223 }
224 #else 224 #else
225 bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint, 225 bool SkPictureShader::asNewEffect(GrContext* context, const SkPaint& paint,
226 const SkMatrix* localMatrix, GrColor* paintCol or, 226 const SkMatrix* localMatrix, GrColor* paintCol or,
227 GrEffect** effect) const { 227 GrEffect** effect) const {
228 SkDEBUGFAIL("Should not call in GPU-less build"); 228 SkDEBUGFAIL("Should not call in GPU-less build");
229 return false; 229 return false;
230 } 230 }
231 #endif 231 #endif
OLDNEW
« no previous file with comments | « src/core/SkPictureRecorder.cpp ('k') | src/core/SkPictureStateTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698