summaryrefslogtreecommitdiffstats
path: root/cc/raster/tile_task_runner.cc
blob: 50e8805d938136719e73c7c4b191144035d55180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright 2014 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/raster/tile_task_runner.h"
#include "cc/resources/platform_color.h"

namespace cc {

TileTask::TileTask() : did_schedule_(false), did_complete_(false) {
}

TileTask::~TileTask() {
  DCHECK(!did_schedule_);
  DCHECK(!did_run_ || did_complete_);
}

void TileTask::WillSchedule() {
  DCHECK(!did_schedule_);
}

void TileTask::DidSchedule() {
  did_schedule_ = true;
  did_complete_ = false;
}

bool TileTask::HasBeenScheduled() const {
  return did_schedule_;
}

void TileTask::WillComplete() {
  DCHECK(!did_complete_);
}

void TileTask::DidComplete() {
  DCHECK(did_schedule_);
  DCHECK(!did_complete_);
  did_schedule_ = false;
  did_complete_ = true;
}

bool TileTask::HasCompleted() const {
  return did_complete_;
}

ImageDecodeTask::ImageDecodeTask() {
}

ImageDecodeTask::~ImageDecodeTask() {
}

RasterTask::RasterTask(ImageDecodeTask::Vector* dependencies) {
  dependencies_.swap(*dependencies);
}

RasterTask::~RasterTask() {
}

bool TileTaskRunner::ResourceFormatRequiresSwizzle(ResourceFormat format) {
  switch (format) {
    case RGBA_8888:
    case BGRA_8888:
      // Initialize resource using the preferred PlatformColor component
      // order and swizzle in the shader instead of in software.
      return !PlatformColor::SameComponentOrder(format);
    case RGBA_4444:
    case ETC1:
    case ALPHA_8:
    case LUMINANCE_8:
    case RGB_565:
    case RED_8:
    case LUMINANCE_F16:
      return false;
  }
  NOTREACHED();
  return false;
}

}  // namespace cc