forked from Pissandshittium/pissandshittium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plumb the ability to store non-SkImage in PaintImage.
This patch adds the ability for PaintImage to be backed by structure other than SkImage. In this patch, the following changes are made: - Add a PaintImageBuilder for partially setting some of the flags for use on the final PaintImage - Removes ImageForCurrentFrame from blink and replaces it with PopulateImageForCurrentFrame which takes a paint image builder instead. - Replaces SkImages constructed from paint records to store paint records directly on the PaintImage - Renames sk_image() to GetSkImage(), which generates an underlying SkImage and caches it on PaintImage - Exposes width/height and IsLazyGenerated from PaintImage so that access to the underlying SkImage is limited. Follow-up work: - Add ability to store a decoder on PaintImage - Stop using GetSkImage internally for things like width/height. R=chrishtr@chromium.org, khushalsagar@chromium.org Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Change-Id: I0b95e13d437d7a99ad80e2286c2bb0c58330a9b3 Reviewed-on: https://chromium-review.googlesource.com/583930 Commit-Queue: Vladimir Levin <vmpstr@chromium.org> Reviewed-by: Khushal <khushalsagar@chromium.org> Reviewed-by: Chris Harrelson <chrishtr@chromium.org> Cr-Commit-Position: refs/heads/master@{#490227}
- Loading branch information
Showing
59 changed files
with
405 additions
and
225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright 2017 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/paint/paint_image_builder.h" | ||
|
||
namespace cc { | ||
|
||
PaintImageBuilder::PaintImageBuilder() = default; | ||
PaintImageBuilder::~PaintImageBuilder() = default; | ||
|
||
PaintImage PaintImageBuilder::TakePaintImage() const { | ||
DCHECK(!paint_image_.sk_image_ || !paint_image_.paint_record_); | ||
return std::move(paint_image_); | ||
} | ||
|
||
} // namespace cc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2017 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 CC_PAINT_PAINT_IMAGE_BUILDER_H_ | ||
#define CC_PAINT_PAINT_IMAGE_BUILDER_H_ | ||
|
||
#include "cc/paint/paint_export.h" | ||
#include "cc/paint/paint_image.h" | ||
#include "cc/paint/paint_op_buffer.h" | ||
|
||
namespace cc { | ||
|
||
class CC_PAINT_EXPORT PaintImageBuilder { | ||
public: | ||
PaintImageBuilder(); | ||
~PaintImageBuilder(); | ||
|
||
void set_id(PaintImage::Id id) { paint_image_.id_ = id; } | ||
void set_image(sk_sp<SkImage> sk_image) { | ||
paint_image_.sk_image_ = std::move(sk_image); | ||
} | ||
void set_paint_record(sk_sp<PaintRecord> paint_record, | ||
const gfx::Rect& rect) { | ||
paint_image_.paint_record_ = std::move(paint_record); | ||
paint_image_.paint_record_rect_ = rect; | ||
} | ||
void set_animation_type(PaintImage::AnimationType type) { | ||
paint_image_.animation_type_ = type; | ||
} | ||
void set_completion_state(PaintImage::CompletionState state) { | ||
paint_image_.completion_state_ = state; | ||
} | ||
void set_frame_count(size_t frame_count) { | ||
paint_image_.frame_count_ = frame_count; | ||
} | ||
void set_is_multipart(bool is_multipart) { | ||
paint_image_.is_multipart_ = is_multipart; | ||
} | ||
|
||
PaintImage TakePaintImage() const; | ||
|
||
private: | ||
PaintImage paint_image_; | ||
}; | ||
|
||
} // namespace cc | ||
|
||
#endif // CC_PAINT_PAINT_IMAGE_BUILDER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.