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

Side by Side Diff: dm/DMSrcSinkAndroid.h

Issue 974913002: ViaAndroidSDK for DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Derek's comment changes Created 5 years, 9 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
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSinkAndroid.cpp » ('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 #ifndef DMSrcSinkAndroid_DEFINED 8 #ifndef DMSrcSinkAndroid_DEFINED
9 #define DMSrcSinkAndroid_DEFINED 9 #define DMSrcSinkAndroid_DEFINED
10 10
11 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK 11 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
12 12
13 #include "DMSrcSink.h" 13 #include "DMSrcSink.h"
14 14
15 namespace DM { 15 namespace DM {
16 16
17 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 17 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
18 18
19 // Draws to the Android Framework's HWUI API.
20
19 class HWUISink : public Sink { 21 class HWUISink : public Sink {
20 public: 22 public:
21 HWUISink() { } 23 HWUISink() { }
22 24
23 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE; 25 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE;
24 int enclave() const SK_OVERRIDE { return kGPU_Enclave; } 26 int enclave() const SK_OVERRIDE { return kGPU_Enclave; }
25 const char* fileExtension() const SK_OVERRIDE { return "png"; } 27 const char* fileExtension() const SK_OVERRIDE { return "png"; }
26 28
27 private: 29 private:
28 const float kDensity = 1.0f; 30 const float kDensity = 1.0f;
29 inline float dp(int x) const { return x * kDensity; } 31 inline float dp(int x) const { return x * kDensity; }
30 }; 32 };
31 33
32 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 34 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
33 35
36 // Trims draw commands to only include those supported by the Android Framework' s HWUI API.
37
38 class ViaAndroidSDK : public Sink {
39 public:
40 explicit ViaAndroidSDK(Sink*);
41
42 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE;
43 int enclave() const SK_OVERRIDE { return fSink->enclave(); }
44 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension( ); }
45
46 private:
47 SkAutoTDelete<Sink> fSink;
48 };
49
50 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
51
34 } // namespace DM 52 } // namespace DM
35 53
36 #endif // SK_BUILD_FOR_ANDROID_FRAMEWORK 54 #endif // SK_BUILD_FOR_ANDROID_FRAMEWORK
37 55
38 #endif // DMSrcSinkAndroid_DEFINED 56 #endif // DMSrcSinkAndroid_DEFINED
OLDNEW
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSinkAndroid.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698