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

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

Issue 1379783002: Allow one-copy task tile worker pool to use compressed textures. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove needs_conversion, fix tile size unit test and move modulo 4 DCHECK (for tests) Created 5 years 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
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 {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 gfx::BufferFormat BufferFormat(ResourceFormat format) { 90 gfx::BufferFormat BufferFormat(ResourceFormat format) {
91 switch (format) { 91 switch (format) {
92 case BGRA_8888: 92 case BGRA_8888:
93 return gfx::BufferFormat::BGRA_8888; 93 return gfx::BufferFormat::BGRA_8888;
94 case RED_8: 94 case RED_8:
95 return gfx::BufferFormat::R_8; 95 return gfx::BufferFormat::R_8;
96 case RGBA_4444: 96 case RGBA_4444:
97 return gfx::BufferFormat::RGBA_4444; 97 return gfx::BufferFormat::RGBA_4444;
98 case RGBA_8888: 98 case RGBA_8888:
99 return gfx::BufferFormat::RGBA_8888; 99 return gfx::BufferFormat::RGBA_8888;
100 case ETC1:
101 return gfx::BufferFormat::ETC1;
100 case ALPHA_8: 102 case ALPHA_8:
101 case LUMINANCE_8: 103 case LUMINANCE_8:
102 case RGB_565: 104 case RGB_565:
103 case ETC1:
104 break; 105 break;
105 } 106 }
106 NOTREACHED(); 107 NOTREACHED();
107 return gfx::BufferFormat::RGBA_8888; 108 return gfx::BufferFormat::RGBA_8888;
108 } 109 }
109 110
111 bool IsResourceFormatCompressed(ResourceFormat format) {
112 return format == ETC1;
113 }
114
115 bool DoesResourceFormatSupportAlpha(ResourceFormat format) {
116 switch (format) {
117 case RGBA_4444:
118 case RGBA_8888:
119 case BGRA_8888:
120 case ALPHA_8:
121 return true;
122 case LUMINANCE_8:
123 case RGB_565:
124 case ETC1:
125 case RED_8:
126 return false;
127 }
128 NOTREACHED();
129 return false;
130 }
131
110 } // namespace cc 132 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698