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

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

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites Created 4 years, 8 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
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"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 // Old code always serialized the picture. New code writes a 'true' fir st if it did. 133 // Old code always serialized the picture. New code writes a 'true' fir st if it did.
134 if (buffer.isVersionLT(SkReadBuffer::kPictureShaderHasPictureBool_Versio n) || 134 if (buffer.isVersionLT(SkReadBuffer::kPictureShaderHasPictureBool_Versio n) ||
135 buffer.readBool()) { 135 buffer.readBool()) {
136 picture = SkPicture::MakeFromBuffer(buffer); 136 picture = SkPicture::MakeFromBuffer(buffer);
137 } 137 }
138 } 138 }
139 return SkPictureShader::Make(picture, mx, my, &lm, &tile); 139 return SkPictureShader::Make(picture, mx, my, &lm, &tile);
140 } 140 }
141 141
142 void SkPictureShader::flatten(SkWriteBuffer& buffer) const { 142 void SkPictureShader::flatten(SkWriteBuffer& buffer) const {
143 buffer.writeMatrix(this->getLocalMatrix()); 143 buffer.writeMatrix("localMatrix", this->getLocalMatrix());
144 buffer.write32(fTmx); 144 buffer.write32("fTmx", fTmx);
145 buffer.write32(fTmy); 145 buffer.write32("fTmy", fTmy);
146 buffer.writeRect(fTile); 146 buffer.writeRect("fTile", fTile);
147 147
148 // The deserialization code won't trust that our serialized picture is safe to deserialize. 148 // The deserialization code won't trust that our serialized picture is safe to deserialize.
149 // So write a 'false' telling it that we're not serializing a picture. 149 // So write a 'false' telling it that we're not serializing a picture.
150 if (buffer.isCrossProcess() && SkPicture::PictureIOSecurityPrecautionsEnable d()) { 150 if (buffer.isCrossProcess() && SkPicture::PictureIOSecurityPrecautionsEnable d()) {
151 buffer.writeBool(false); 151 buffer.writeBool("picturePresent", false);
152 } else { 152 } else {
153 buffer.writeBool(true); 153 buffer.writeBool("picturePresent", true);
154 fPicture->flatten(buffer); 154 fPicture->flatten(buffer);
155 } 155 }
156 } 156 }
157 157
158 sk_sp<SkShader> SkPictureShader::refBitmapShader(const SkMatrix& viewMatrix, con st SkMatrix* localM, 158 sk_sp<SkShader> SkPictureShader::refBitmapShader(const SkMatrix& viewMatrix, con st SkMatrix* localM,
159 const int maxTextureSize) const { 159 const int maxTextureSize) const {
160 SkASSERT(fPicture && !fPicture->cullRect().isEmpty()); 160 SkASSERT(fPicture && !fPicture->cullRect().isEmpty());
161 161
162 SkMatrix m; 162 SkMatrix m;
163 m.setConcat(viewMatrix, this->getLocalMatrix()); 163 m.setConcat(viewMatrix, this->getLocalMatrix());
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 if (context) { 327 if (context) {
328 maxTextureSize = context->caps()->maxTextureSize(); 328 maxTextureSize = context->caps()->maxTextureSize();
329 } 329 }
330 sk_sp<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix, maxTe xtureSize)); 330 sk_sp<SkShader> bitmapShader(this->refBitmapShader(viewM, localMatrix, maxTe xtureSize));
331 if (!bitmapShader) { 331 if (!bitmapShader) {
332 return nullptr; 332 return nullptr;
333 } 333 }
334 return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq); 334 return bitmapShader->asFragmentProcessor(context, viewM, nullptr, fq);
335 } 335 }
336 #endif 336 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698