OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2016 Google Inc. | 3 * Copyright 2016 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "RasterWindowContext_android.h" | 9 #include "RasterWindowContext_android.h" |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 fDisplayParams = params; | 29 fDisplayParams = params; |
30 ContextPlatformData_android* androidPlatformData = | 30 ContextPlatformData_android* androidPlatformData = |
31 reinterpret_cast<ContextPlatformData_android*>(platformData); | 31 reinterpret_cast<ContextPlatformData_android*>(platformData); |
32 fNativeWindow = androidPlatformData->fNativeWindow; | 32 fNativeWindow = androidPlatformData->fNativeWindow; |
33 fWidth = ANativeWindow_getWidth(fNativeWindow); | 33 fWidth = ANativeWindow_getWidth(fNativeWindow); |
34 fHeight = ANativeWindow_getHeight(fNativeWindow); | 34 fHeight = ANativeWindow_getHeight(fNativeWindow); |
35 this->setBuffersGeometry(); | 35 this->setBuffersGeometry(); |
36 } | 36 } |
37 | 37 |
38 void RasterWindowContext_android::setBuffersGeometry() { | 38 void RasterWindowContext_android::setBuffersGeometry() { |
39 int32_t format; | 39 int32_t format = 0; |
40 switch(fDisplayParams.fColorType) { | 40 switch(fDisplayParams.fColorType) { |
41 case kRGBA_8888_SkColorType: | 41 case kRGBA_8888_SkColorType: |
42 format = WINDOW_FORMAT_RGBA_8888; | 42 format = WINDOW_FORMAT_RGBA_8888; |
43 break; | 43 break; |
44 case kRGB_565_SkColorType: | 44 case kRGB_565_SkColorType: |
45 format = WINDOW_FORMAT_RGB_565; | 45 format = WINDOW_FORMAT_RGB_565; |
46 break; | 46 break; |
47 default: | 47 default: |
48 SkDEBUGFAIL("Unsupported Android color type"); | 48 SK_ABORT("Unsupported Android color type"); |
49 } | 49 } |
50 ANativeWindow_setBuffersGeometry(fNativeWindow, fWidth, fHeight, format); | 50 ANativeWindow_setBuffersGeometry(fNativeWindow, fWidth, fHeight, format); |
51 } | 51 } |
52 | 52 |
53 void RasterWindowContext_android::setDisplayParams(const DisplayParams& params)
{ | 53 void RasterWindowContext_android::setDisplayParams(const DisplayParams& params)
{ |
54 fDisplayParams = params; | 54 fDisplayParams = params; |
55 this->setBuffersGeometry(); | 55 this->setBuffersGeometry(); |
56 } | 56 } |
57 | 57 |
58 void RasterWindowContext_android::resize(uint32_t w, uint32_t h) { | 58 void RasterWindowContext_android::resize(uint32_t w, uint32_t h) { |
(...skipping 16 matching lines...) Expand all Loading... |
75 return fBackbufferSurface; | 75 return fBackbufferSurface; |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 void RasterWindowContext_android::swapBuffers() { | 79 void RasterWindowContext_android::swapBuffers() { |
80 ANativeWindow_unlockAndPost(fNativeWindow); | 80 ANativeWindow_unlockAndPost(fNativeWindow); |
81 fBackbufferSurface.reset(nullptr); | 81 fBackbufferSurface.reset(nullptr); |
82 } | 82 } |
83 | 83 |
84 } // namespace sk_app | 84 } // namespace sk_app |
OLD | NEW |