This source file includes following definitions.
- PaintToBackingImage
- OnPaint
#include "ui/app_list/views/cached_label.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
namespace app_list {
CachedLabel::CachedLabel()
: needs_repaint_(true) {
}
void CachedLabel::PaintToBackingImage() {
if (image_.size() == size() && !needs_repaint_)
return;
gfx::Canvas canvas(size(), 1.0f, false );
canvas.FillRect(GetLocalBounds(), SkColorSetARGB(0, 0, 0, 0),
SkXfermode::kSrc_Mode);
Label::OnPaint(&canvas);
image_ = gfx::ImageSkia(canvas.ExtractImageRep());
needs_repaint_ = false;
}
#if defined(OS_WIN)
void CachedLabel::OnPaint(gfx::Canvas* canvas) {
PaintToBackingImage();
canvas->DrawImageInt(image_, 0, 0);
}
#endif
}