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

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

Issue 263293005: add local-matrix to shader::context (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add/fix comments Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkBlitter.h ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
4 * 3 *
5 * 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
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
8 7
9
10 #include "SkBlitter.h" 8 #include "SkBlitter.h"
11 #include "SkAntiRun.h" 9 #include "SkAntiRun.h"
12 #include "SkColor.h" 10 #include "SkColor.h"
13 #include "SkColorFilter.h" 11 #include "SkColorFilter.h"
14 #include "SkCoreBlitters.h" 12 #include "SkCoreBlitters.h"
15 #include "SkFilterShader.h" 13 #include "SkFilterShader.h"
16 #include "SkReadBuffer.h" 14 #include "SkReadBuffer.h"
17 #include "SkWriteBuffer.h" 15 #include "SkWriteBuffer.h"
18 #include "SkMask.h" 16 #include "SkMask.h"
19 #include "SkMaskFilter.h" 17 #include "SkMaskFilter.h"
20 #include "SkString.h" 18 #include "SkString.h"
21 #include "SkTLazy.h" 19 #include "SkTLazy.h"
22 #include "SkUtils.h" 20 #include "SkUtils.h"
23 #include "SkXfermode.h" 21 #include "SkXfermode.h"
24 22
25 SkBlitter::~SkBlitter() {} 23 SkBlitter::~SkBlitter() {}
26 24
27 bool SkBlitter::isNullBlitter() const { return false; } 25 bool SkBlitter::isNullBlitter() const { return false; }
28 26
29 bool SkBlitter::resetShaderContext(const SkBitmap& device, const SkPaint& paint, 27 bool SkBlitter::resetShaderContext(const SkShader::ContextRec&) {
30 const SkMatrix& matrix) {
31 return true; 28 return true;
32 } 29 }
33 30
34 SkShader::Context* SkBlitter::getShaderContext() const { 31 SkShader::Context* SkBlitter::getShaderContext() const {
35 return NULL; 32 return NULL;
36 } 33 }
37 34
38 const SkBitmap* SkBlitter::justAnOpaqueColor(uint32_t* value) { 35 const SkBitmap* SkBlitter::justAnOpaqueColor(uint32_t* value) {
39 return NULL; 36 return NULL;
40 } 37 }
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
1023 SkASSERT(fShaderContext); 1020 SkASSERT(fShaderContext);
1024 1021
1025 fShader->ref(); 1022 fShader->ref();
1026 fShaderFlags = fShaderContext->getFlags(); 1023 fShaderFlags = fShaderContext->getFlags();
1027 } 1024 }
1028 1025
1029 SkShaderBlitter::~SkShaderBlitter() { 1026 SkShaderBlitter::~SkShaderBlitter() {
1030 fShader->unref(); 1027 fShader->unref();
1031 } 1028 }
1032 1029
1033 bool SkShaderBlitter::resetShaderContext(const SkBitmap& device, const SkPaint& paint, 1030 bool SkShaderBlitter::resetShaderContext(const SkShader::ContextRec& rec) {
1034 const SkMatrix& matrix) {
1035 SkShader::ContextRec rec(device, paint, matrix);
1036
1037 // Only destroy the old context if we have a new one. We need to ensure to h ave a 1031 // Only destroy the old context if we have a new one. We need to ensure to h ave a
1038 // live context in fShaderContext because the storage is owned by an SkSmall Allocator 1032 // live context in fShaderContext because the storage is owned by an SkSmall Allocator
1039 // outside of this class. 1033 // outside of this class.
1040 // The new context will be of the same size as the old one because we use th e same 1034 // The new context will be of the same size as the old one because we use th e same
1041 // shader to create it. It is therefore safe to re-use the storage. 1035 // shader to create it. It is therefore safe to re-use the storage.
1042 fShaderContext->~Context(); 1036 fShaderContext->~Context();
1043 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); 1037 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext);
1044 if (NULL == ctx) { 1038 if (NULL == ctx) {
1045 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call 1039 // Need a valid context in fShaderContext's storage, so we can later (or our caller) call
1046 // the in-place destructor. 1040 // the in-place destructor.
1047 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad er, rec)); 1041 SkNEW_PLACEMENT_ARGS(fShaderContext, SkTransparentShaderContext, (*fShad er, rec));
1042 return false;
1048 } 1043 }
1049 return ctx != NULL; 1044 return true;
1050 } 1045 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter.h ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698