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

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

Issue 775663002: Revert of cc: Added RED_8 to the ResourceFormat enum (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/texture_uploader_unittest.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_provider.h" 5 #include "cc/resources/resource_provider.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/containers/hash_tables.h" 10 #include "base/containers/hash_tables.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 case RGBA_8888: 69 case RGBA_8888:
70 break; 70 break;
71 case BGRA_8888: 71 case BGRA_8888:
72 storage_format = GL_BGRA8_EXT; 72 storage_format = GL_BGRA8_EXT;
73 break; 73 break;
74 case RGBA_4444: 74 case RGBA_4444:
75 case ALPHA_8: 75 case ALPHA_8:
76 case LUMINANCE_8: 76 case LUMINANCE_8:
77 case RGB_565: 77 case RGB_565:
78 case ETC1: 78 case ETC1:
79 case RED_8:
80 NOTREACHED(); 79 NOTREACHED();
81 break; 80 break;
82 } 81 }
83 82
84 return storage_format; 83 return storage_format;
85 } 84 }
86 85
87 bool IsFormatSupportedForStorage(ResourceFormat format, bool use_bgra) { 86 bool IsFormatSupportedForStorage(ResourceFormat format, bool use_bgra) {
88 switch (format) { 87 switch (format) {
89 case RGBA_8888: 88 case RGBA_8888:
90 return true; 89 return true;
91 case BGRA_8888: 90 case BGRA_8888:
92 return use_bgra; 91 return use_bgra;
93 case RGBA_4444: 92 case RGBA_4444:
94 case ALPHA_8: 93 case ALPHA_8:
95 case LUMINANCE_8: 94 case LUMINANCE_8:
96 case RGB_565: 95 case RGB_565:
97 case ETC1: 96 case ETC1:
98 case RED_8:
99 return false; 97 return false;
100 } 98 }
101 return false; 99 return false;
102 } 100 }
103 101
104 GrPixelConfig ToGrPixelConfig(ResourceFormat format) { 102 GrPixelConfig ToGrPixelConfig(ResourceFormat format) {
105 switch (format) { 103 switch (format) {
106 case RGBA_8888: 104 case RGBA_8888:
107 return kRGBA_8888_GrPixelConfig; 105 return kRGBA_8888_GrPixelConfig;
108 case BGRA_8888: 106 case BGRA_8888:
(...skipping 11 matching lines...) Expand all
120 switch (format) { 118 switch (format) {
121 case RGBA_8888: 119 case RGBA_8888:
122 return gfx::GpuMemoryBuffer::Format::RGBA_8888; 120 return gfx::GpuMemoryBuffer::Format::RGBA_8888;
123 case BGRA_8888: 121 case BGRA_8888:
124 return gfx::GpuMemoryBuffer::Format::BGRA_8888; 122 return gfx::GpuMemoryBuffer::Format::BGRA_8888;
125 case RGBA_4444: 123 case RGBA_4444:
126 case ALPHA_8: 124 case ALPHA_8:
127 case LUMINANCE_8: 125 case LUMINANCE_8:
128 case RGB_565: 126 case RGB_565:
129 case ETC1: 127 case ETC1:
130 case RED_8:
131 break; 128 break;
132 } 129 }
133 NOTREACHED(); 130 NOTREACHED();
134 return gfx::GpuMemoryBuffer::Format::RGBA_8888; 131 return gfx::GpuMemoryBuffer::Format::RGBA_8888;
135 } 132 }
136 133
137 class ScopedSetActiveTexture { 134 class ScopedSetActiveTexture {
138 public: 135 public:
139 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) 136 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit)
140 : gl_(gl), unit_(unit) { 137 : gl_(gl), unit_(unit) {
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2157 ContextProvider* context_provider = output_surface_->context_provider(); 2154 ContextProvider* context_provider = output_surface_->context_provider();
2158 return context_provider ? context_provider->ContextGL() : NULL; 2155 return context_provider ? context_provider->ContextGL() : NULL;
2159 } 2156 }
2160 2157
2161 class GrContext* ResourceProvider::GrContext() const { 2158 class GrContext* ResourceProvider::GrContext() const {
2162 ContextProvider* context_provider = output_surface_->context_provider(); 2159 ContextProvider* context_provider = output_surface_->context_provider();
2163 return context_provider ? context_provider->GrContext() : NULL; 2160 return context_provider ? context_provider->GrContext() : NULL;
2164 } 2161 }
2165 2162
2166 } // namespace cc 2163 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.h ('k') | cc/resources/texture_uploader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698