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

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

Issue 773563002: Pre-cache local matrix type in shader constructor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkColorShader.h" 9 #include "SkColorShader.h"
10 #include "SkEmptyShader.h" 10 #include "SkEmptyShader.h"
(...skipping 26 matching lines...) Expand all
37 #endif 37 #endif
38 } 38 }
39 39
40 SkShader::SkShader(const SkMatrix* localMatrix) { 40 SkShader::SkShader(const SkMatrix* localMatrix) {
41 inc_shader_counter(); 41 inc_shader_counter();
42 if (localMatrix) { 42 if (localMatrix) {
43 fLocalMatrix = *localMatrix; 43 fLocalMatrix = *localMatrix;
44 } else { 44 } else {
45 fLocalMatrix.reset(); 45 fLocalMatrix.reset();
46 } 46 }
47 // Pre-cache so future calls to fLocalMatrix.getType() are threadsafe.
48 (void)fLocalMatrix.getType();
47 } 49 }
48 50
49 SkShader::~SkShader() { 51 SkShader::~SkShader() {
50 dec_shader_counter(); 52 dec_shader_counter();
51 } 53 }
52 54
53 void SkShader::flatten(SkWriteBuffer& buffer) const { 55 void SkShader::flatten(SkWriteBuffer& buffer) const {
54 this->INHERITED::flatten(buffer); 56 this->INHERITED::flatten(buffer);
55 bool hasLocalM = !fLocalMatrix.isIdentity(); 57 bool hasLocalM = !fLocalMatrix.isIdentity();
56 buffer.writeBool(hasLocalM); 58 buffer.writeBool(hasLocalM);
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 #include "SkEmptyShader.h" 387 #include "SkEmptyShader.h"
386 388
387 void SkEmptyShader::toString(SkString* str) const { 389 void SkEmptyShader::toString(SkString* str) const {
388 str->append("SkEmptyShader: ("); 390 str->append("SkEmptyShader: (");
389 391
390 this->INHERITED::toString(str); 392 this->INHERITED::toString(str);
391 393
392 str->append(")"); 394 str->append(")");
393 } 395 }
394 #endif 396 #endif
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