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

Side by Side Diff: gm/imagefiltersgraph.cpp

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (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 | « gm/imagefiltersbase.cpp ('k') | include/core/SkColorFilter.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 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 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 "gm.h" 8 #include "gm.h"
9 9
10 #include "SkArithmeticMode.h" 10 #include "SkArithmeticMode.h"
(...skipping 11 matching lines...) Expand all
22 #include "SkXfermodeImageFilter.h" 22 #include "SkXfermodeImageFilter.h"
23 23
24 // More closely models how Blink's OffsetFilter works as of 10/23/13. SkOffsetIm ageFilter doesn't 24 // More closely models how Blink's OffsetFilter works as of 10/23/13. SkOffsetIm ageFilter doesn't
25 // perform a draw and this one does. 25 // perform a draw and this one does.
26 class SimpleOffsetFilter : public SkImageFilter { 26 class SimpleOffsetFilter : public SkImageFilter {
27 public: 27 public:
28 class Registrar { 28 class Registrar {
29 public: 29 public:
30 Registrar() { 30 Registrar() {
31 SkFlattenable::Register("SimpleOffsetFilter", 31 SkFlattenable::Register("SimpleOffsetFilter",
32 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
33 SimpleOffsetFilter::DeepCreateProc,
34 #else
32 SimpleOffsetFilter::CreateProc, 35 SimpleOffsetFilter::CreateProc,
36 #endif
33 SimpleOffsetFilter::GetFlattenableType()); 37 SimpleOffsetFilter::GetFlattenableType());
34 } 38 }
35 }; 39 };
36 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input) { 40 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkImageFilter* input) {
37 return SkNEW_ARGS(SimpleOffsetFilter, (dx, dy, input)); 41 return SkNEW_ARGS(SimpleOffsetFilter, (dx, dy, input));
38 } 42 }
39 43
40 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx, 44 virtual bool onFilterImage(Proxy* proxy, const SkBitmap& src, const Context& ctx,
41 SkBitmap* dst, SkIPoint* offset) const SK_OVERRID E { 45 SkBitmap* dst, SkIPoint* offset) const SK_OVERRID E {
42 SkBitmap source = src; 46 SkBitmap source = src;
(...skipping 15 matching lines...) Expand all
58 canvas.drawBitmap(source, fDX - bounds.left(), fDY - bounds.top(), &pain t); 62 canvas.drawBitmap(source, fDX - bounds.left(), fDY - bounds.top(), &pain t);
59 *dst = device->accessBitmap(false); 63 *dst = device->accessBitmap(false);
60 offset->fX += bounds.left(); 64 offset->fX += bounds.left();
61 offset->fY += bounds.top(); 65 offset->fY += bounds.top();
62 return true; 66 return true;
63 } 67 }
64 68
65 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SimpleOffsetFilter); 69 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SimpleOffsetFilter);
66 70
67 protected: 71 protected:
72 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
73 explicit SimpleOffsetFilter(SkReadBuffer& buffer)
74 : SkImageFilter(1, buffer) {
75 fDX = buffer.readScalar();
76 fDY = buffer.readScalar();
77 }
78 #endif
79
68 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { 80 virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE {
69 this->INHERITED::flatten(buffer); 81 this->INHERITED::flatten(buffer);
70 buffer.writeScalar(fDX); 82 buffer.writeScalar(fDX);
71 buffer.writeScalar(fDY); 83 buffer.writeScalar(fDY);
72 } 84 }
73 85
74 private: 86 private:
75 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input) 87 SimpleOffsetFilter(SkScalar dx, SkScalar dy, SkImageFilter* input)
76 : SkImageFilter(1, &input), fDX(dx), fDY(dy) {} 88 : SkImageFilter(1, &input), fDX(dx), fDY(dy) {}
77 89
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 231
220 private: 232 private:
221 typedef GM INHERITED; 233 typedef GM INHERITED;
222 SkBitmap fBitmap; 234 SkBitmap fBitmap;
223 }; 235 };
224 236
225 /////////////////////////////////////////////////////////////////////////////// 237 ///////////////////////////////////////////////////////////////////////////////
226 238
227 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; } 239 static skiagm::GM* MyFactory(void*) { return new ImageFiltersGraphGM; }
228 static skiagm::GMRegistry reg(MyFactory); 240 static skiagm::GMRegistry reg(MyFactory);
OLDNEW
« no previous file with comments | « gm/imagefiltersbase.cpp ('k') | include/core/SkColorFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698