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

Unified Diff: cc/output/overlay_candidate.cc

Issue 2748903002: cc: Add gfx::BufferFormat to cc::ResourceProvider::Resource. (Closed)
Patch Set: Always initialize buffer_format. Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/ipc/transferable_resource_struct_traits.cc ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/overlay_candidate.cc
diff --git a/cc/output/overlay_candidate.cc b/cc/output/overlay_candidate.cc
index 64ee2a5766822feccf2798c45864f1dfaafdec50..e41b62b4bf175a95b4bf93a1149ce49f5c1d2fa9 100644
--- a/cc/output/overlay_candidate.cc
+++ b/cc/output/overlay_candidate.cc
@@ -22,6 +22,11 @@ namespace {
// Tolerance for considering axis vector elements to be zero.
const SkMScalar kEpsilon = std::numeric_limits<float>::epsilon();
+const gfx::BufferFormat kOverlayFormats[] = {
+ gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::RGBA_8888,
+ gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::BGRA_8888,
+ gfx::BufferFormat::BGR_565};
+
enum Axis { NONE, AXIS_POS_X, AXIS_NEG_X, AXIS_POS_Y, AXIS_NEG_Y };
Axis VectorToAxis(const gfx::Vector3dF& vec) {
@@ -257,6 +262,12 @@ bool OverlayCandidate::FromTextureQuad(ResourceProvider* resource_provider,
OverlayCandidate* candidate) {
if (!resource_provider->IsOverlayCandidate(quad->resource_id()))
return false;
+
+ gfx::BufferFormat format =
+ resource_provider->GetBufferFormat(quad->resource_id());
+ if (std::find(std::begin(kOverlayFormats), std::end(kOverlayFormats),
+ format) == std::end(kOverlayFormats))
+ return false;
gfx::OverlayTransform overlay_transform = GetOverlayTransform(
quad->shared_quad_state->quad_to_target_transform, quad->y_flipped);
if (quad->background_color != SK_ColorTRANSPARENT ||
« no previous file with comments | « cc/ipc/transferable_resource_struct_traits.cc ('k') | cc/resources/resource_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698