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

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

Issue 395603002: Simplify flattening to just write enough to call the factory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: simplify xfermodes, fix SkLayerDrawLooper Created 6 years, 4 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 2012 The Android Open Source Project 2 * Copyright 2012 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 "SkImageFilter.h" 8 #include "SkImageFilter.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 sk_bzero(fInputs.get(), size); 68 sk_bzero(fInputs.get(), size);
69 } 69 }
70 70
71 void SkImageFilter::Common::detachInputs(SkImageFilter** inputs) { 71 void SkImageFilter::Common::detachInputs(SkImageFilter** inputs) {
72 const size_t size = fInputs.count() * sizeof(SkImageFilter*); 72 const size_t size = fInputs.count() * sizeof(SkImageFilter*);
73 memcpy(inputs, fInputs.get(), size); 73 memcpy(inputs, fInputs.get(), size);
74 sk_bzero(fInputs.get(), size); 74 sk_bzero(fInputs.get(), size);
75 } 75 }
76 76
77 bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) { 77 bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) {
78 int count = buffer.readInt(); 78 const int count = buffer.readInt();
79 if (expectedCount < 0) { // means the caller doesn't care how many 79 if (!buffer.validate(count >= 0)) {
sugoi1 2014/08/19 18:46:16 If it is no longer possible to use an expectedCoun
reed1 2014/08/19 19:58:05 Good catch, I think I no longer take -1.
80 expectedCount = count; 80 return false;
81 } 81 }
82 if (!buffer.validate((count == expectedCount) && (count >= 0))) { 82 if (!buffer.validate((count == expectedCount) && (count >= 0))) {
83 return false; 83 return false;
84 } 84 }
85 85
86 this->allocInputs(count); 86 this->allocInputs(count);
87 for (int i = 0; i < count; i++) { 87 for (int i = 0; i < count; i++) {
88 if (buffer.readBool()) { 88 if (buffer.readBool()) {
89 fInputs[i] = buffer.readImageFilter(); 89 fInputs[i] = buffer.readImageFilter();
90 } 90 }
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 } // namespace 492 } // namespace
493 493
494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) { 494 SkImageFilter::Cache* SkImageFilter::Cache::Create(size_t maxBytes) {
495 return SkNEW_ARGS(CacheImpl, (maxBytes)); 495 return SkNEW_ARGS(CacheImpl, (maxBytes));
496 } 496 }
497 497
498 SkImageFilter::Cache* SkImageFilter::Cache::Get() { 498 SkImageFilter::Cache* SkImageFilter::Cache::Get() {
499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache); 499 SK_DECLARE_STATIC_LAZY_PTR(SkImageFilter::Cache, cache, CreateCache);
500 return cache.get(); 500 return cache.get();
501 } 501 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698