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

Side by Side Diff: dm/DMSrcSinkAndroid.cpp

Issue 1407053009: Simplify linkages to Android framework internals (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: One gyp file is much like another Created 5 years, 1 month 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 | « bench/nanobenchAndroid.cpp ('k') | gyp/bench.gyp » ('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 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
11 #include "SkAndroidSDKCanvas.h" 11 #include "SkAndroidSDKCanvas.h"
12 #include "SkCanvas.h" 12 #include "SkCanvas.h"
13 #include "SkHwuiRenderer.h"
14 #include "SkiaCanvasProxy.h" 13 #include "SkiaCanvasProxy.h"
15 #include "SkStream.h" 14 #include "SkStream.h"
15 #include <utils/TestWindowContext.h>
16 16
17 /* These functions are only compiled in the Android Framework. */ 17 /* These functions are only compiled in the Android Framework. */
18 18
19 namespace DM { 19 namespace DM {
20 20
21 Error HWUISink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const { 21 Error HWUISink::draw(const Src& src, SkBitmap* dst, SkWStream*, SkString*) const {
22 SkHwuiRenderer renderer; 22 android::uirenderer::TestWindowContext renderer;
23 renderer.initialize(src.size()); 23 renderer.initialize(src.size().width(), src.size().height());
24 SkCanvas* canvas = renderer.prepareToDraw(); 24 SkCanvas* canvas = renderer.prepareToDraw();
25 Error err = src.draw(canvas); 25 Error err = src.draw(canvas);
26 if (!err.isEmpty()) { 26 if (!err.isEmpty()) {
27 return err; 27 return err;
28 } 28 }
29 renderer.finishDrawing(); 29 renderer.finishDrawing();
30 renderer.proxy->fence(); 30 renderer.fence();
31 renderer.capturePixels(dst); 31 renderer.capturePixels(dst);
32 return ""; 32 return "";
33 } 33 }
34 34
35 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 35 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
36 36
37 ViaAndroidSDK::ViaAndroidSDK(Sink* sink) : fSink(sink) { } 37 ViaAndroidSDK::ViaAndroidSDK(Sink* sink) : fSink(sink) { }
38 38
39 Error ViaAndroidSDK::draw(const Src& src, 39 Error ViaAndroidSDK::draw(const Src& src,
40 SkBitmap* bitmap, 40 SkBitmap* bitmap,
(...skipping 19 matching lines...) Expand all
60 return ""; 60 return "";
61 } 61 }
62 SkISize size() const override { return fSrc.size(); } 62 SkISize size() const override { return fSrc.size(); }
63 Name name() const override { sk_throw(); return ""; } 63 Name name() const override { sk_throw(); return ""; }
64 } proxy(src); 64 } proxy(src);
65 65
66 return fSink->draw(proxy, bitmap, stream, log); 66 return fSink->draw(proxy, bitmap, stream, log);
67 } 67 }
68 68
69 } // namespace DM 69 } // namespace DM
OLDNEW
« no previous file with comments | « bench/nanobenchAndroid.cpp ('k') | gyp/bench.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698