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

Unified Diff: ui/android/resources/crushed_sprite_resource.h

Issue 2798123002: Remove crushed sprite resource and layer (Closed)
Patch Set: Rebase and fix my nits Created 3 years, 8 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
Index: ui/android/resources/crushed_sprite_resource.h
diff --git a/ui/android/resources/crushed_sprite_resource.h b/ui/android/resources/crushed_sprite_resource.h
deleted file mode 100644
index 605f22f3dc8d899318132fc0298f267703a50d01..0000000000000000000000000000000000000000
--- a/ui/android/resources/crushed_sprite_resource.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2015 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.
-
-#ifndef UI_ANDROID_RESOURCES_CRUSHED_SPRITE_RESOURCE_H_
-#define UI_ANDROID_RESOURCES_CRUSHED_SPRITE_RESOURCE_H_
-
-#include <memory>
-#include <utility>
-#include <vector>
-
-#include "base/macros.h"
-#include "third_party/skia/include/core/SkBitmap.h"
-#include "ui/android/ui_android_export.h"
-#include "ui/gfx/geometry/rect.h"
-
-namespace cc {
-typedef int UIResourceId;
-}
-
-namespace ui {
-
-// A resource that provides an unscaled bitmap and corresponding metadata for a
-// crushed sprite. A crushed sprite animation is run by drawing rectangles from
-// a bitmap to a canvas. Each frame in the animation draws its rectangles on top
-// of the previous frame.
-class UI_ANDROID_EXPORT CrushedSpriteResource {
- public:
- typedef std::vector<std::pair<gfx::Rect, gfx::Rect>> FrameSrcDstRects;
- typedef std::vector<FrameSrcDstRects> SrcDstRects;
-
- // Creates a new CrushedSpriteResource. |bitmap_res_id| is the id for the
- // for the source bitmap, |java_bitmap| is the source bitmap for the crushed
- // sprite, |src_dst_rects| is a list of rectangles to draw for each frame, and
- // |unscaled_sprite_size| is the size of an individual sprite unscaled. The
- // sprite should be drawn at its unscaled size then scaled to
- // |scaled_sprite_size|.
- CrushedSpriteResource(const SkBitmap& bitmap,
- const SrcDstRects& src_dst_rects,
- gfx::Size unscaled_sprite_size,
- gfx::Size scaled_sprite_size);
- ~CrushedSpriteResource();
-
- // Sets the source bitmap.
- void SetBitmap(const SkBitmap& bitmap);
-
- // Returns the source bitmap.
- const SkBitmap& GetBitmap();
-
- // Evicts bitmap_ from memory.
- void EvictBitmapFromMemory();
-
- // Returns true if the source bitmap has been evicted from memory.
- bool BitmapHasBeenEvictedFromMemory();
-
- // Returns a list of rectangles to be drawn for |frame|.
- FrameSrcDstRects GetRectanglesForFrame(int frame);
-
- // Returns the unscaled size of an individual sprite.
- gfx::Size GetUnscaledSpriteSize();
-
- // Returns the scaled size of an individual sprite.
- gfx::Size GetScaledSpriteSize();
-
- // Returns the total number of frames in the sprite animation.
- int GetFrameCount();
-
- // Returns the memory usage of the bitmap.
- size_t EstimateMemoryUsage() const;
-
- private:
- SkBitmap bitmap_;
- SrcDstRects src_dst_rects_;
- gfx::Size unscaled_sprite_size_;
- gfx::Size scaled_sprite_size_;
-
- DISALLOW_COPY_AND_ASSIGN(CrushedSpriteResource);
-};
-
-} // namespace ui
-
-#endif // UI_ANDROID_RESOURCES_CRUSHED_SPRITE_RESOURCE_H_

Powered by Google App Engine
This is Rietveld 408576698