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

Side by Side Diff: src/image/SkImageShader.cpp

Issue 2419333002: Skip SkBitmapProvider instantiation in SkImageShader::onContextSize (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | 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 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkBitmapProvider.h" 9 #include "SkBitmapProvider.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
(...skipping 28 matching lines...) Expand all
39 buffer.writeUInt(fTileModeY); 39 buffer.writeUInt(fTileModeY);
40 buffer.writeMatrix(this->getLocalMatrix()); 40 buffer.writeMatrix(this->getLocalMatrix());
41 buffer.writeImage(fImage.get()); 41 buffer.writeImage(fImage.get());
42 } 42 }
43 43
44 bool SkImageShader::isOpaque() const { 44 bool SkImageShader::isOpaque() const {
45 return fImage->isOpaque(); 45 return fImage->isOpaque();
46 } 46 }
47 47
48 size_t SkImageShader::onContextSize(const ContextRec& rec) const { 48 size_t SkImageShader::onContextSize(const ContextRec& rec) const {
49 return SkBitmapProcLegacyShader::ContextSize(rec, SkBitmapProvider(fImage.ge t()).info()); 49 return SkBitmapProcLegacyShader::ContextSize(rec, as_IB(fImage)->onImageInfo ());
50 } 50 }
51 51
52 SkShader::Context* SkImageShader::onCreateContext(const ContextRec& rec, void* s torage) const { 52 SkShader::Context* SkImageShader::onCreateContext(const ContextRec& rec, void* s torage) const {
53 return SkBitmapProcLegacyShader::MakeContext(*this, fTileModeX, fTileModeY, 53 return SkBitmapProcLegacyShader::MakeContext(*this, fTileModeX, fTileModeY,
54 SkBitmapProvider(fImage.get()), rec, storage); 54 SkBitmapProvider(fImage.get()), rec, storage);
55 } 55 }
56 56
57 SkImage* SkImageShader::onIsAImage(SkMatrix* texM, TileMode xy[]) const { 57 SkImage* SkImageShader::onIsAImage(SkMatrix* texM, TileMode xy[]) const {
58 if (texM) { 58 if (texM) {
59 *texM = this->getLocalMatrix(); 59 *texM = this->getLocalMatrix();
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt(); 257 SkShader::TileMode mx = (SkShader::TileMode)buffer.readUInt();
258 SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt(); 258 SkShader::TileMode my = (SkShader::TileMode)buffer.readUInt();
259 return image ? image->makeShader(mx, my, &lm) : nullptr; 259 return image ? image->makeShader(mx, my, &lm) : nullptr;
260 } 260 }
261 261
262 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShader) 262 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkShader)
263 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) 263 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader)
264 SkFlattenable::Register("SkBitmapProcShader", SkBitmapProcShader_CreateProc, kSk Shader_Type); 264 SkFlattenable::Register("SkBitmapProcShader", SkBitmapProcShader_CreateProc, kSk Shader_Type);
265 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 265 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
266 266
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698