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

Side by Side Diff: cc/output/overlay_candidate.cc

Issue 2753333002: Enable NV12 HW overlays. (Closed)
Patch Set: Rebase. 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 unified diff | Download patch
« no previous file with comments | « no previous file | components/exo/display.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/output/overlay_candidate.h" 5 #include "cc/output/overlay_candidate.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
11 #include "cc/quads/solid_color_draw_quad.h" 11 #include "cc/quads/solid_color_draw_quad.h"
12 #include "cc/quads/stream_video_draw_quad.h" 12 #include "cc/quads/stream_video_draw_quad.h"
13 #include "cc/quads/texture_draw_quad.h" 13 #include "cc/quads/texture_draw_quad.h"
14 #include "cc/quads/tile_draw_quad.h" 14 #include "cc/quads/tile_draw_quad.h"
15 #include "cc/resources/resource_provider.h" 15 #include "cc/resources/resource_provider.h"
16 #include "ui/gfx/geometry/rect_conversions.h" 16 #include "ui/gfx/geometry/rect_conversions.h"
17 #include "ui/gfx/geometry/vector3d_f.h" 17 #include "ui/gfx/geometry/vector3d_f.h"
18 18
19 namespace cc { 19 namespace cc {
20 20
21 namespace { 21 namespace {
22 // Tolerance for considering axis vector elements to be zero. 22 // Tolerance for considering axis vector elements to be zero.
23 const SkMScalar kEpsilon = std::numeric_limits<float>::epsilon(); 23 const SkMScalar kEpsilon = std::numeric_limits<float>::epsilon();
24 24
25 const gfx::BufferFormat kOverlayFormats[] = { 25 const gfx::BufferFormat kOverlayFormats[] = {
26 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::RGBA_8888, 26 gfx::BufferFormat::RGBX_8888, gfx::BufferFormat::RGBA_8888,
27 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::BGRA_8888, 27 gfx::BufferFormat::BGRX_8888, gfx::BufferFormat::BGRA_8888,
28 gfx::BufferFormat::BGR_565}; 28 gfx::BufferFormat::BGR_565, gfx::BufferFormat::YUV_420_BIPLANAR};
29 29
30 enum Axis { NONE, AXIS_POS_X, AXIS_NEG_X, AXIS_POS_Y, AXIS_NEG_Y }; 30 enum Axis { NONE, AXIS_POS_X, AXIS_NEG_X, AXIS_POS_Y, AXIS_NEG_Y };
31 31
32 Axis VectorToAxis(const gfx::Vector3dF& vec) { 32 Axis VectorToAxis(const gfx::Vector3dF& vec) {
33 if (std::abs(vec.z()) > kEpsilon) 33 if (std::abs(vec.z()) > kEpsilon)
34 return NONE; 34 return NONE;
35 const bool x_zero = (std::abs(vec.x()) <= kEpsilon); 35 const bool x_zero = (std::abs(vec.x()) <= kEpsilon);
36 const bool y_zero = (std::abs(vec.y()) <= kEpsilon); 36 const bool y_zero = (std::abs(vec.y()) <= kEpsilon);
37 if (x_zero && !y_zero) 37 if (x_zero && !y_zero)
38 return (vec.y() > 0) ? AXIS_POS_Y : AXIS_NEG_Y; 38 return (vec.y() > 0) ? AXIS_POS_Y : AXIS_NEG_Y;
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 345
346 OverlayCandidateList& OverlayCandidateList::operator=( 346 OverlayCandidateList& OverlayCandidateList::operator=(
347 OverlayCandidateList&& other) = default; 347 OverlayCandidateList&& other) = default;
348 348
349 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) { 349 void OverlayCandidateList::AddPromotionHint(const OverlayCandidate& candidate) {
350 promotion_hint_info_map_[candidate.resource_id] = 350 promotion_hint_info_map_[candidate.resource_id] =
351 candidate.display_rect.origin(); 351 candidate.display_rect.origin();
352 } 352 }
353 353
354 } // namespace cc 354 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | components/exo/display.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698