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

Side by Side Diff: cc/tiles/mipmap_util.h

Issue 2042133002: Add display-resolution caching to GPU IDC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@drt
Patch Set: combine with crrev.com/2103353002 Created 4 years, 5 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 | « cc/tiles/gpu_image_decode_controller_unittest.cc ('k') | cc/tiles/mipmap_util.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #ifndef CC_TILES_MIPMAP_UTIL_H_ 5 #ifndef CC_TILES_MIPMAP_UTIL_H_
6 #define CC_TILES_MIPMAP_UTIL_H_ 6 #define CC_TILES_MIPMAP_UTIL_H_
7 7
8 #include "cc/base/cc_export.h" 8 #include "cc/base/cc_export.h"
9 #include "third_party/skia/include/core/SkSize.h" 9 #include "third_party/skia/include/core/SkSize.h"
10 #include "ui/gfx/skia_util.h" 10 #include "ui/gfx/skia_util.h"
11 11
12 namespace cc { 12 namespace cc {
13 13
14 class CC_EXPORT MipMapUtil { 14 class CC_EXPORT MipMapUtil {
15 public: 15 public:
16 // Determine the smallest mip level that is larger than |target_size|. Each 16 // Determine the smallest mip level that is larger than |target_size|. Each
17 // mip level corresponds to a power of two scale of the image - for instance, 17 // mip level corresponds to a power of two scale of the image - for instance,
18 // level 0 is original size, level 1 is 2x smaller, level 2 is 4x smaller, 18 // level 0 is original size, level 1 is 2x smaller, level 2 is 4x smaller,
19 // etc... 19 // etc...
20 // Returns -1 if |src_size| or |target_size| is invalid (any dimension is 0). 20 // Returns -1 if |src_size| or |target_size| is invalid (any dimension is 0).
21 static int GetLevelForSize(const gfx::Size& src_size, 21 static int GetLevelForSize(const gfx::Size& src_size,
22 const gfx::Size& target_size); 22 const gfx::Size& target_size);
23 23
24 // Determines the scale factor for the given |mip_level|. Returns (-1, -1) if 24 // Determines the scale factor for the given |mip_level|. Returns (-1, -1) if
25 // |src_size| is invalid (width/height <= 0), or if mip_level is invalid (== 25 // |src_size| is invalid (width/height <= 0), or if mip_level is invalid (==
26 // -1). 26 // -1).
27 static SkSize GetScaleAdjustmentForLevel(const gfx::Size& src_size, 27 static SkSize GetScaleAdjustmentForLevel(const gfx::Size& src_size,
28 int mip_level); 28 int mip_level);
29 29
30 // Determine the size of the given |mip_level|. Returns (-1, -1) if
31 // |src_size| is invalid (width/height <= 0) or if mip-level is invalid (==
32 // -1).
33 static gfx::Size GetSizeForLevel(const gfx::Size& src_size, int mip_level);
34
30 // Determines the scale factor for the smallest mip level that is larger than 35 // Determines the scale factor for the smallest mip level that is larger than
31 // |target_size|. Returns (-1, -1) if |src_size| or |target_size| is invalid 36 // |target_size|. Returns (-1, -1) if |src_size| or |target_size| is invalid
32 // (width/height <= 0). 37 // (width/height <= 0).
33 static SkSize GetScaleAdjustmentForSize(const gfx::Size& src_size, 38 static SkSize GetScaleAdjustmentForSize(const gfx::Size& src_size,
34 const gfx::Size& target_size); 39 const gfx::Size& target_size);
35 }; 40 };
36 41
37 } // namespace cc 42 } // namespace cc
38 43
39 #endif // CC_TILES_MIPMAP_UTIL_H_ 44 #endif // CC_TILES_MIPMAP_UTIL_H_
OLDNEW
« no previous file with comments | « cc/tiles/gpu_image_decode_controller_unittest.cc ('k') | cc/tiles/mipmap_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698