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

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

Issue 1757993002: add support for new bitmapshader context (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: enforce 16byte alignment in more places Created 4 years, 9 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/SkShader.cpp ('k') | tests/SkColor4fTest.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 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 "SkImage_Base.h" 10 #include "SkImage_Base.h"
(...skipping 25 matching lines...) Expand all
36 buffer.writeUInt(fTileModeY); 36 buffer.writeUInt(fTileModeY);
37 buffer.writeMatrix(this->getLocalMatrix()); 37 buffer.writeMatrix(this->getLocalMatrix());
38 buffer.writeImage(fImage); 38 buffer.writeImage(fImage);
39 } 39 }
40 40
41 bool SkImageShader::isOpaque() const { 41 bool SkImageShader::isOpaque() const {
42 return fImage->isOpaque(); 42 return fImage->isOpaque();
43 } 43 }
44 44
45 size_t SkImageShader::contextSize(const ContextRec& rec) const { 45 size_t SkImageShader::contextSize(const ContextRec& rec) const {
46 return SkBitmapProcShader::ContextSize(rec); 46 return SkBitmapProcShader::ContextSize(rec, SkBitmapProvider(fImage).info()) ;
47 } 47 }
48 48
49 SkShader::Context* SkImageShader::onCreateContext(const ContextRec& rec, void* s torage) const { 49 SkShader::Context* SkImageShader::onCreateContext(const ContextRec& rec, void* s torage) const {
50 return SkBitmapProcShader::MakeContext(*this, fTileModeX, fTileModeY, 50 return SkBitmapProcShader::MakeContext(*this, fTileModeX, fTileModeY,
51 SkBitmapProvider(fImage), rec, storag e); 51 SkBitmapProvider(fImage), rec, storag e);
52 } 52 }
53 53
54 SkShader* SkImageShader::Create(const SkImage* image, TileMode tx, TileMode ty, 54 SkShader* SkImageShader::Create(const SkImage* image, TileMode tx, TileMode ty,
55 const SkMatrix* localMatrix) { 55 const SkMatrix* localMatrix) {
56 if (!image) { 56 if (!image) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); 125 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params));
126 } 126 }
127 127
128 if (GrPixelConfigIsAlphaOnly(texture->config())) { 128 if (GrPixelConfigIsAlphaOnly(texture->config())) {
129 return SkRef(inner.get()); 129 return SkRef(inner.get());
130 } 130 }
131 return GrFragmentProcessor::MulOutputByInputAlpha(inner); 131 return GrFragmentProcessor::MulOutputByInputAlpha(inner);
132 } 132 }
133 133
134 #endif 134 #endif
OLDNEW
« no previous file with comments | « src/core/SkShader.cpp ('k') | tests/SkColor4fTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698