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

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

Issue 735493003: 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
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:
79 NOTREACHED(); 80 NOTREACHED();
80 break; 81 break;
81 } 82 }
82 83
83 return storage_format; 84 return storage_format;
84 } 85 }
85 86
86 bool IsFormatSupportedForStorage(ResourceFormat format, bool use_bgra) { 87 bool IsFormatSupportedForStorage(ResourceFormat format, bool use_bgra) {
87 switch (format) { 88 switch (format) {
88 case RGBA_8888: 89 case RGBA_8888:
89 return true; 90 return true;
90 case BGRA_8888: 91 case BGRA_8888:
91 return use_bgra; 92 return use_bgra;
92 case RGBA_4444: 93 case RGBA_4444:
93 case ALPHA_8: 94 case ALPHA_8:
94 case LUMINANCE_8: 95 case LUMINANCE_8:
95 case RGB_565: 96 case RGB_565:
96 case ETC1: 97 case ETC1:
98 case RED_8:
97 return false; 99 return false;
98 } 100 }
99 return false; 101 return false;
100 } 102 }
101 103
102 GrPixelConfig ToGrPixelConfig(ResourceFormat format) { 104 GrPixelConfig ToGrPixelConfig(ResourceFormat format) {
103 switch (format) { 105 switch (format) {
104 case RGBA_8888: 106 case RGBA_8888:
105 return kRGBA_8888_GrPixelConfig; 107 return kRGBA_8888_GrPixelConfig;
106 case BGRA_8888: 108 case BGRA_8888:
(...skipping 11 matching lines...) Expand all
118 switch (format) { 120 switch (format) {
119 case RGBA_8888: 121 case RGBA_8888:
120 return gfx::GpuMemoryBuffer::Format::RGBA_8888; 122 return gfx::GpuMemoryBuffer::Format::RGBA_8888;
121 case BGRA_8888: 123 case BGRA_8888:
122 return gfx::GpuMemoryBuffer::Format::BGRA_8888; 124 return gfx::GpuMemoryBuffer::Format::BGRA_8888;
123 case RGBA_4444: 125 case RGBA_4444:
124 case ALPHA_8: 126 case ALPHA_8:
125 case LUMINANCE_8: 127 case LUMINANCE_8:
126 case RGB_565: 128 case RGB_565:
127 case ETC1: 129 case ETC1:
130 case RED_8:
128 break; 131 break;
129 } 132 }
130 NOTREACHED(); 133 NOTREACHED();
131 return gfx::GpuMemoryBuffer::Format::RGBA_8888; 134 return gfx::GpuMemoryBuffer::Format::RGBA_8888;
132 } 135 }
133 136
134 class ScopedSetActiveTexture { 137 class ScopedSetActiveTexture {
135 public: 138 public:
136 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit) 139 ScopedSetActiveTexture(GLES2Interface* gl, GLenum unit)
137 : gl_(gl), unit_(unit) { 140 : gl_(gl), unit_(unit) {
(...skipping 2016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2154 ContextProvider* context_provider = output_surface_->context_provider(); 2157 ContextProvider* context_provider = output_surface_->context_provider();
2155 return context_provider ? context_provider->ContextGL() : NULL; 2158 return context_provider ? context_provider->ContextGL() : NULL;
2156 } 2159 }
2157 2160
2158 class GrContext* ResourceProvider::GrContext() const { 2161 class GrContext* ResourceProvider::GrContext() const {
2159 ContextProvider* context_provider = output_surface_->context_provider(); 2162 ContextProvider* context_provider = output_surface_->context_provider();
2160 return context_provider ? context_provider->GrContext() : NULL; 2163 return context_provider ? context_provider->GrContext() : NULL;
2161 } 2164 }
2162 2165
2163 } // namespace cc 2166 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698