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

Unified Diff: cc/image_layer.cc

Issue 12603013: Part 10 of cc/ directory shuffles: layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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/image_layer.h ('k') | cc/input/top_controls_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/image_layer.cc
diff --git a/cc/image_layer.cc b/cc/image_layer.cc
deleted file mode 100644
index d7ac960815659a44ab9b700afc34bef09788ac86..0000000000000000000000000000000000000000
--- a/cc/image_layer.cc
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "cc/image_layer.h"
-
-#include "base/compiler_specific.h"
-#include "cc/resources/image_layer_updater.h"
-#include "cc/resources/layer_updater.h"
-#include "cc/resources/prioritized_resource.h"
-#include "cc/resources/resource_update_queue.h"
-#include "cc/trees/layer_tree_host.h"
-
-namespace cc {
-
-scoped_refptr<ImageLayer> ImageLayer::Create() {
- return make_scoped_refptr(new ImageLayer());
-}
-
-ImageLayer::ImageLayer() : TiledLayer() {}
-
-ImageLayer::~ImageLayer() {}
-
-void ImageLayer::SetBitmap(const SkBitmap& bitmap) {
- // SetBitmap() currently gets called whenever there is any
- // style change that affects the layer even if that change doesn't
- // affect the actual contents of the image (e.g. a CSS animation).
- // With this check in place we avoid unecessary texture uploads.
- if (bitmap.pixelRef() && bitmap.pixelRef() == bitmap_.pixelRef())
- return;
-
- bitmap_ = bitmap;
- SetNeedsDisplay();
-}
-
-void ImageLayer::SetTexturePriorities(const PriorityCalculator& priority_calc) {
- // Update the tile data before creating all the layer's tiles.
- UpdateTileSizeAndTilingOption();
-
- TiledLayer::SetTexturePriorities(priority_calc);
-}
-
-void ImageLayer::Update(ResourceUpdateQueue* queue,
- const OcclusionTracker* occlusion,
- RenderingStats* stats) {
- CreateUpdaterIfNeeded();
- if (needs_display_) {
- updater_->set_bitmap(bitmap_);
- UpdateTileSizeAndTilingOption();
- InvalidateContentRect(gfx::Rect(content_bounds()));
- needs_display_ = false;
- }
- TiledLayer::Update(queue, occlusion, stats);
-}
-
-void ImageLayer::CreateUpdaterIfNeeded() {
- if (updater_)
- return;
-
- updater_ = ImageLayerUpdater::Create();
- GLenum texture_format =
- layer_tree_host()->GetRendererCapabilities().best_texture_format;
- SetTextureFormat(texture_format);
-}
-
-LayerUpdater* ImageLayer::Updater() const {
- return updater_.get();
-}
-
-void ImageLayer::CalculateContentsScale(float ideal_contents_scale,
- bool animating_transform_to_screen,
- float* contents_scale_x,
- float* contents_scale_y,
- gfx::Size* content_bounds) {
- *contents_scale_x = ImageContentsScaleX();
- *contents_scale_y = ImageContentsScaleY();
- *content_bounds = gfx::Size(bitmap_.width(), bitmap_.height());
-}
-
-bool ImageLayer::DrawsContent() const {
- return !bitmap_.isNull() && TiledLayer::DrawsContent();
-}
-
-float ImageLayer::ImageContentsScaleX() const {
- if (bounds().IsEmpty() || bitmap_.width() == 0)
- return 1;
- return static_cast<float>(bitmap_.width()) / bounds().width();
-}
-
-float ImageLayer::ImageContentsScaleY() const {
- if (bounds().IsEmpty() || bitmap_.height() == 0)
- return 1;
- return static_cast<float>(bitmap_.height()) / bounds().height();
-}
-
-} // namespace cc
« no previous file with comments | « cc/image_layer.h ('k') | cc/input/top_controls_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698