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

Side by Side Diff: cc/resources/resource_format.cc

Issue 2020993004: Implement TransferableResource StructTraits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 6 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 | « cc/resources/resource_format.h ('k') | cc/resources/resource_format_utils.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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/resources/resource_format.h" 5 #include "cc/resources/resource_format.h"
6 6
7 #include "third_party/khronos/GLES2/gl2.h" 7 #include "third_party/khronos/GLES2/gl2.h"
8 #include "third_party/khronos/GLES2/gl2ext.h" 8 #include "third_party/khronos/GLES2/gl2ext.h"
9 9
10 namespace cc { 10 namespace cc {
11 11
12 SkColorType ResourceFormatToClosestSkColorType(ResourceFormat format) {
13 // Use kN32_SkColorType if there is no corresponding SkColorType.
14 switch (format) {
15 case RGBA_4444:
16 return kARGB_4444_SkColorType;
17 case RGBA_8888:
18 case BGRA_8888:
19 return kN32_SkColorType;
20 case ALPHA_8:
21 return kAlpha_8_SkColorType;
22 case RGB_565:
23 return kRGB_565_SkColorType;
24 case LUMINANCE_8:
25 return kGray_8_SkColorType;
26 case ETC1:
27 case RED_8:
28 case LUMINANCE_F16:
29 return kN32_SkColorType;
30 }
31 NOTREACHED();
32 return kN32_SkColorType;
33 }
34
35 int BitsPerPixel(ResourceFormat format) { 12 int BitsPerPixel(ResourceFormat format) {
36 switch (format) { 13 switch (format) {
37 case BGRA_8888: 14 case BGRA_8888:
38 case RGBA_8888: 15 case RGBA_8888:
39 return 32; 16 return 32;
40 case RGBA_4444: 17 case RGBA_4444:
41 case RGB_565: 18 case RGB_565:
42 case LUMINANCE_F16: 19 case LUMINANCE_F16:
43 return 16; 20 return 16;
44 case ALPHA_8: 21 case ALPHA_8:
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 case ETC1: 109 case ETC1:
133 case RED_8: 110 case RED_8:
134 case LUMINANCE_F16: 111 case LUMINANCE_F16:
135 return false; 112 return false;
136 } 113 }
137 NOTREACHED(); 114 NOTREACHED();
138 return false; 115 return false;
139 } 116 }
140 117
141 } // namespace cc 118 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_format.h ('k') | cc/resources/resource_format_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698