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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 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/SkColorFilter.cpp ('k') | src/core/SkDataTable.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 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 9
10 #include "SkComposeShader.h" 10 #include "SkComposeShader.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 }; 53 };
54 #define SkAutoAlphaRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoAlphaRestore) 54 #define SkAutoAlphaRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoAlphaRestore)
55 55
56 SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) { 56 SkFlattenable* SkComposeShader::CreateProc(SkReadBuffer& buffer) {
57 SkAutoTUnref<SkShader> shaderA(buffer.readShader()); 57 SkAutoTUnref<SkShader> shaderA(buffer.readShader());
58 SkAutoTUnref<SkShader> shaderB(buffer.readShader()); 58 SkAutoTUnref<SkShader> shaderB(buffer.readShader());
59 SkAutoTUnref<SkXfermode> mode(buffer.readXfermode()); 59 SkAutoTUnref<SkXfermode> mode(buffer.readXfermode());
60 if (!shaderA.get() || !shaderB.get()) { 60 if (!shaderA.get() || !shaderB.get()) {
61 return NULL; 61 return NULL;
62 } 62 }
63 return SkNEW_ARGS(SkComposeShader, (shaderA, shaderB, mode)); 63 return new SkComposeShader(shaderA, shaderB, mode);
64 } 64 }
65 65
66 void SkComposeShader::flatten(SkWriteBuffer& buffer) const { 66 void SkComposeShader::flatten(SkWriteBuffer& buffer) const {
67 buffer.writeFlattenable(fShaderA); 67 buffer.writeFlattenable(fShaderA);
68 buffer.writeFlattenable(fShaderB); 68 buffer.writeFlattenable(fShaderB);
69 buffer.writeFlattenable(fMode); 69 buffer.writeFlattenable(fMode);
70 } 70 }
71 71
72 template <typename T> void safe_call_destructor(T* obj) { 72 template <typename T> void safe_call_destructor(T* obj) {
73 if (obj) { 73 if (obj) {
(...skipping 21 matching lines...) Expand all
95 newRec.fPaint = &opaquePaint; 95 newRec.fPaint = &opaquePaint;
96 96
97 SkShader::Context* contextA = fShaderA->createContext(newRec, aStorage); 97 SkShader::Context* contextA = fShaderA->createContext(newRec, aStorage);
98 SkShader::Context* contextB = fShaderB->createContext(newRec, bStorage); 98 SkShader::Context* contextB = fShaderB->createContext(newRec, bStorage);
99 if (!contextA || !contextB) { 99 if (!contextA || !contextB) {
100 safe_call_destructor(contextA); 100 safe_call_destructor(contextA);
101 safe_call_destructor(contextB); 101 safe_call_destructor(contextB);
102 return NULL; 102 return NULL;
103 } 103 }
104 104
105 return SkNEW_PLACEMENT_ARGS(storage, ComposeShaderContext, (*this, rec, cont extA, contextB)); 105 return new (storage) ComposeShaderContext(*this, rec, contextA, contextB);
106 } 106 }
107 107
108 SkComposeShader::ComposeShaderContext::ComposeShaderContext( 108 SkComposeShader::ComposeShaderContext::ComposeShaderContext(
109 const SkComposeShader& shader, const ContextRec& rec, 109 const SkComposeShader& shader, const ContextRec& rec,
110 SkShader::Context* contextA, SkShader::Context* contextB) 110 SkShader::Context* contextA, SkShader::Context* contextB)
111 : INHERITED(shader, rec) 111 : INHERITED(shader, rec)
112 , fShaderContextA(contextA) 112 , fShaderContextA(contextA)
113 , fShaderContextB(contextB) {} 113 , fShaderContextB(contextB) {}
114 114
115 SkComposeShader::ComposeShaderContext::~ComposeShaderContext() { 115 SkComposeShader::ComposeShaderContext::~ComposeShaderContext() {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (fMode) { 205 if (fMode) {
206 str->append(" Xfermode: "); 206 str->append(" Xfermode: ");
207 fMode->toString(str); 207 fMode->toString(str);
208 } 208 }
209 209
210 this->INHERITED::toString(str); 210 this->INHERITED::toString(str);
211 211
212 str->append(")"); 212 str->append(")");
213 } 213 }
214 #endif 214 #endif
OLDNEW
« no previous file with comments | « src/core/SkColorFilter.cpp ('k') | src/core/SkDataTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698