| OLD | NEW |
| 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 "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
| 9 #include "DMSrcSinkAndroid.h" | 9 #include "DMSrcSinkAndroid.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 /* These functions are only compiled in the Android Framework. */ | 32 /* These functions are only compiled in the Android Framework. */ |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| 36 /** | 36 /** |
| 37 * Helper class for setting up android::uirenderer::renderthread::RenderProxy. | 37 * Helper class for setting up android::uirenderer::renderthread::RenderProxy. |
| 38 */ | 38 */ |
| 39 class ContextFactory : public android::uirenderer::IContextFactory { | 39 class ContextFactory : public android::uirenderer::IContextFactory { |
| 40 public: | 40 public: |
| 41 android::uirenderer::AnimationContext* createAnimationContext | 41 android::uirenderer::AnimationContext* createAnimationContext |
| 42 (android::uirenderer::renderthread::TimeLord& clock) SK_OVERRIDE { | 42 (android::uirenderer::renderthread::TimeLord& clock) override { |
| 43 return new android::uirenderer::AnimationContext(clock); | 43 return new android::uirenderer::AnimationContext(clock); |
| 44 } | 44 } |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 namespace DM { | 49 namespace DM { |
| 50 | 50 |
| 51 Error HWUISink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const
{ | 51 Error HWUISink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const
{ |
| 52 // Do all setup in this function because we don't know the size | 52 // Do all setup in this function because we don't know the size |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 Error ViaAndroidSDK::draw(const Src& src, | 175 Error ViaAndroidSDK::draw(const Src& src, |
| 176 SkBitmap* bitmap, | 176 SkBitmap* bitmap, |
| 177 SkWStream* stream, | 177 SkWStream* stream, |
| 178 SkString* log) const { | 178 SkString* log) const { |
| 179 struct ProxySrc : public Src { | 179 struct ProxySrc : public Src { |
| 180 const Src& fSrc; | 180 const Src& fSrc; |
| 181 ProxySrc(const Src& src) | 181 ProxySrc(const Src& src) |
| 182 : fSrc(src) {} | 182 : fSrc(src) {} |
| 183 | 183 |
| 184 Error draw(SkCanvas* canvas) const SK_OVERRIDE { | 184 Error draw(SkCanvas* canvas) const override { |
| 185 // Pass through HWUI's upper layers to get operational transforms | 185 // Pass through HWUI's upper layers to get operational transforms |
| 186 SkAutoTDelete<android::Canvas> ac (android::Canvas::create_canvas(ca
nvas)); | 186 SkAutoTDelete<android::Canvas> ac (android::Canvas::create_canvas(ca
nvas)); |
| 187 SkAutoTUnref<android::uirenderer::SkiaCanvasProxy> scProxy | 187 SkAutoTUnref<android::uirenderer::SkiaCanvasProxy> scProxy |
| 188 (new android::uirenderer::SkiaCanvasProxy(ac)); | 188 (new android::uirenderer::SkiaCanvasProxy(ac)); |
| 189 | 189 |
| 190 // Pass through another proxy to get paint transforms | 190 // Pass through another proxy to get paint transforms |
| 191 SkAndroidSDKCanvas fc; | 191 SkAndroidSDKCanvas fc; |
| 192 fc.reset(scProxy); | 192 fc.reset(scProxy); |
| 193 | 193 |
| 194 fSrc.draw(&fc); | 194 fSrc.draw(&fc); |
| 195 | 195 |
| 196 return ""; | 196 return ""; |
| 197 } | 197 } |
| 198 SkISize size() const SK_OVERRIDE { return fSrc.size(); } | 198 SkISize size() const override { return fSrc.size(); } |
| 199 Name name() const SK_OVERRIDE { sk_throw(); return ""; } | 199 Name name() const override { sk_throw(); return ""; } |
| 200 } proxy(src); | 200 } proxy(src); |
| 201 | 201 |
| 202 return fSink->draw(proxy, bitmap, stream, log); | 202 return fSink->draw(proxy, bitmap, stream, log); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace DM | 205 } // namespace DM |
| OLD | NEW |